Hi guys, I have been building a basket process based on a combination of Quicksilver, Commerce Traing Examples and the documentation. I have followed the examples for adding and updating a cart but when I call
cart.ValidateOrRemoveLineItems((item, issue) => validationMessages += CreateValidationMessages(item, issue), _lineItemValidator);
cart.UpdatePlacedPriceOrRemoveLineItems(contact, (item, issue) => validationMessages += CreateValidationMessages(item, issue), _placedPriceProcessor);
cart.UpdateInventoryOrRemoveLineItems((item, issue) => validationMessages += CreateValidationMessages(item, issue), _inventoryProcessor);
I get back PlacedPricedChanged in the error list. The price is set according to the documentation for the Default Market, has not changed at all from what's set and I have checked and this is doing exactly as the QuickSilver demo is and as I've seen on other posts.
The other issue is if I remove the price check which allow the basket to add the item correctly and everything to work the Inventory check isn't working. I've set the Inventory to 0 quantity but I'm still able to add items which I thought the UpdateInventoryOrRemoveLineItems was supposed to handle.
I'm confused, I'm doing as QuickSilver and the documents show but it's not expecting as I would imagine
Any help please? Thanks in advance
The price changed will be triggered if the price that is read from the pricing provider is different than the one that is already stored on the line item. Looking at the code it could be a bug becasue it rounds the price from the line item but not from the pricing provider.
For inventory make sure the variation had track inventory checked as well as the fulfillment center warehouse. If one is not set to track inventory the extension method will just return from the method and not check any inventory
Thanks Mark, yes it must be a bug I'm definately not changing the price. I'll check the warehouse settings, I already checked the SKU in commerce to make sure inventory is tracked. Hopefully that's it or I'll have to add it to the custom LineItemValidator I'm writing
Where abouts is the warehouse setting for this, I can't see it in admin area for the warehouse?
Okay, it turns out I had the Is Tracked on the Inventory item set but not the Tracked checkbox on the SKU set. I can't see any global settings for this, is there a way to default Tracked on the SKU level to on?
Also the price issue seems to be fine now the item is marked as tracked. It obbviously doesn't track the item properly if not and can't compare the prices so always raises the isse
There are two way to set the tracking: either on the SKU level, or on a specific warehouse of a SKU. So there is no global setting, or there is no warehouse level setting.
If you want to turn off inventory tracking globally, you can just modify the workflows to remove that part.
Thanks Quan, can I clarify.
Can I clarify something, I understand that the the SKU level is the Tracked flag on the SKU Item, but the specifici warehouse is this supposed to be in the Inventory management area also on the SKU level area in the Catalgoe management system. I can't see any tracking flag on the Warehouse specifically and when the flag was set on the Inventory tracking area but not the SKU level nothing happened in workflow, I debugged the default code as as the SKU "Tracked" flag was flag the whol process was skipped.