In our project we're experiencing that the stock quantity on the SKU isn't updating when a customer places an order.
We only have one warehouse, which is set as available, primary, fulfillment center and pickup location.
The validation of the stock quantity in the ValidateCart workflow works as expected, the customer isn't able to buy the SKU if the stock is 0, or more than the stock quantity if it's above zero.
Both inventory status and tracking are enabled. The CartCheckout workflow is running and the AdjustInventory activity is enabled in the workflow.
The stock quantity isn't updated in any environments, including locally.
Does anyone have a suggestion on what might be the issue?
Which version are you using?
Prior to Commerce 8.8, there're some limitations with inventory system and I would recommend to upgrade to Commerce 8.8, or later version, for better and smarter inventory system.
The stock adjustment is made in the AdjustInventoryActivity, you might grab our Workflow project, build it and debug to see what happens in that activity.
Thanks for the reply!
We're using Commerce 126.96.36.1996 and CMS 188.8.131.52.
I'll try what you're suggesting.
By debugging the AdjustInventoryActivity I found that the OperationKeysMap on the shipments always contains 0 elements, event though the shipment contains several LineItemIndexes. When is OperationKeysMap supposed to be populated?
In RequestInventory method of AdjustInventoryActivity (aka when user places an order), we make request to the inventory system and then store return data in shipment.OperationKeys. Those data will be used to commit the changes when you complete the shipment, or revert the changes if you cancel it. Those behaviors are documented here: http://world.episerver.com/documentation/Items/Developers-Guide/EPiServer-Commerce/8/Warehouses-and-inventories/inventory-requests/
Do you have a custom workflow project, or are you using our default workflow?
We're using the default workflow.
When we debug the AdjustInventoryActivity the RequestInventory method is never called - it seems like the activity is only run when the request type is Complete.
It's also called in this condition
else if (orderGroupStatus == OrderStatus.InProgress || orderGroupStatus == OrderStatus.AwaitingExchange)
// When placing an order or creating an exchange order
bool placingOrder = shipmentStatus == OrderShipmentStatus.AwaitingInventory || shipmentStatus == OrderShipmentStatus.InventoryAssigned;
So make sure your order and shipment have correct status.
We finally found out what the error was!
In out project we're skipping the "Awaiting Inventory" status on the shipments and setting them to "Released" programmatically. We were doing this before the CartCheckoutWorkflow was run, so in the AdjustInventoryActivity the third condition (orderGroupStatus == OrderStatus.InProgress || orderGroupStatus == OrderStatus.AwaitingExchange) was never reached. We're now changing the shipment status after the CartCheckoutWorkflow has run.
Thank you for your help Quan!