Start a new topic
Answered

Stock reservation

Hi, can you assist me in determining when in the exact shopping experience the stock is reserved. Is it when after the customer placed the order or saved during shopping.

For example, an item has 5 stocks and I added 4 items in my shopping cart. Then later another customer placed 2 in his shopping cart and he checkout first. Who will have the correct items?


Thank you so much!


Best Answer

Hi Grace,


the inventory is checked inside CheckInventoryActivity which is executed at every request to the cart. It simply checks the Inventory table to see how many items available. The inventory is adjusted in the "Checkout" workflow inside "AdjustStockInventoryActivity", this is where the stocks are updated (executed on place order button). This is a default scenario in the demo site and can be easily adjusted to fit your business needs. In that default scenario, the person who wanted to buy 4 items will get a message that inventory changed and 1 item will be removed from his/her cart. 


If however you would like to change this behavior, simply add Adjust Inventory activity to the "Prepare" workflow and it will cause inventory to be deducted as soon as item is placed allowing user one to order 4 items and not allowing second user to add more than 1 item. You will need to remove AdjustInventory from the "Checkout" activity. And you will also need to create some sort of job that clears not completed carts and returns inventory back. Similar how Promotion Reservation system works.


Let me know if you need more guidance or what business scenario your trying to solve.


PS: reserved count in inventory is used to have some reserved quantity to prevent overselling (for example when there is both physical and online stores using same inventory).


Hope this helps,

Sasha.


1 Comment

Answer

Hi Grace,


the inventory is checked inside CheckInventoryActivity which is executed at every request to the cart. It simply checks the Inventory table to see how many items available. The inventory is adjusted in the "Checkout" workflow inside "AdjustStockInventoryActivity", this is where the stocks are updated (executed on place order button). This is a default scenario in the demo site and can be easily adjusted to fit your business needs. In that default scenario, the person who wanted to buy 4 items will get a message that inventory changed and 1 item will be removed from his/her cart. 


If however you would like to change this behavior, simply add Adjust Inventory activity to the "Prepare" workflow and it will cause inventory to be deducted as soon as item is placed allowing user one to order 4 items and not allowing second user to add more than 1 item. You will need to remove AdjustInventory from the "Checkout" activity. And you will also need to create some sort of job that clears not completed carts and returns inventory back. Similar how Promotion Reservation system works.


Let me know if you need more guidance or what business scenario your trying to solve.


PS: reserved count in inventory is used to have some reserved quantity to prevent overselling (for example when there is both physical and online stores using same inventory).


Hope this helps,

Sasha.


Login or Signup to post a comment