Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Inventory not adjusted and order in status "Awaiting inventory" - why ??


Hi there.

I'm having trouble seeing how the inventory should be adjusted.

I add items to my cart, add a payment with a billingaddress and save the cart as an order (_orderRepository.SaveAsPurchaseOrder). The variations have inventory in the warehouse and the warehouse is attached to the shipping.

The order shows up in commerce-manager - but in state "Awaiting inventory" and my inventory is not down-adjusted ;-)

The book "Pro Episerver Commerce" mentions the new way of doing it is using InventoryRequest and InventoryRequestItem - but they are not used in Quicksilver at all. 

The book also says that "When a customer places an order, the workflow (specifically AdjustInventoryActivity activity) will create InventoryRequestItems for each lineitem in the cart" - but I (and quicksilver) are not using workflows - should I ? And how ?

I'm using this code when adding item to the cart (from quicksilver):

cart.ValidateOrRemoveLineItems((item, issue) => validationIssues.AddValidationIssues(item, issue));
cart.UpdatePlacedPriceOrRemoveLineItems((item, issue) => validationIssues.AddValidationIssues(item, issue));
cart.UpdateInventoryOrRemoveLineItems((item, issue) => validationIssues.AddValidationIssues(item, issue));

Best regards


Nov 30, 2016 16:17


Using workflows to check and adjust inventory is the "traditional" way - and it's still supported. We also provide newer APis - as you see in Quicksilver to do the same functionalities. So they are just two ways of doing the sameing (and internally using the same APIs). 

Can you post your full code of placing order here? It seems you are missing this 

public Dictionary<ILineItem, List<ValidationIssue>> RequestInventory(ICart cart)
var validationIssues = new Dictionary<ILineItem, List<ValidationIssue>>();
cart.AdjustInventoryOrRemoveLineItems((item, issue) => validationIssues.AddValidationIssues(item, issue), _inventoryProcessor);
return validationIssues;

This actually allocates inventories for the items.



P/s: and thank you for your purchase :) 

Dec 01, 2016 9:36

UpdateInventoryOrRemoveLineItems() checks that a sufficient inventory quantity exists for the selected shipment warehouse. This method also updates the line item with the available quantity or, if none are available, removes it.

What you are looking for is 

//Adjust inventory on shipment line items
var shipment = cart.GetFirstShipment();
inventoryProcessor.AdjustInventoryOrRemoveLineItems(shipment, cart.OrderStatus, (item, issue) => validationIssues.Add(item, issue));

See also documentation here:

Dec 01, 2016 9:36

Thx. a lot to you both!

Best regards Carsten

Dec 02, 2016 8:55
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.