Hi,
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.
Regards,
/Q
P/s: and thank you for your purchase :)
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:
http://world.episerver.com/documentation/Items/Developers-Guide/Episerver-Commerce/9/Orders/order-processing/
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
Carsten