We have code for the basket which we have written that follows the quicksilver example in how line items are added to the basket.
It generally all works however when adding the item to the basket for the first time and calling the validate methods calling the workflow validation
cart.ValidateOrRemoveLineItems((item, issue) => HandleError(issue, validationErrors), _lineItemValidator);
cart.UpdatePlacedPriceOrRemoveLineItems(contact, (item, issue) => HandleError(issue, validationErrors), _placedPriceProcessor);
cart.UpdateInventoryOrRemoveLineItems((item, issue) => HandleError(issue, validationErrors), _inventoryProcessor);
We are always getting PlacedPricedChanged returned back. It only happens on the first call however after that everything is fine? Can some advise why this is and how to resolve it?
On the phone right now, but IIRC then when you create the line item there is no price. The processing code will then get the price and set it for you. So that is expected and nothing to worry about. You can of course set the price yourself but that means more work.
Thanks Quan you're always helpful, yeah I gather than because it's a fresh line item object it's got defaults but surely you don't want the validator to throw back a PlacedPricedChanged validation error when this happens on the first item.
I'm mapping these errors throw to validation messages show for when prices change and baskets are adusted. This means without some custom logic the end user will be shown validation messages, I was hoping the validator would be clever enough to know it's a new line item.
It might make senses to not add the warning if the price was null (i.e. this case). I'll file a bug and let my colleagues decide what to do with it.
Thanks that's what I was thinking for now, just wanted to double check that it's designed to work like that. Thanks for the help