AI OnAI Off
This should be changed
var redemptions = orderForm.Shipments .First() .LineItems .Select(lineItem => new AffectedItem(lineItem)) .Select(affectedItem => new RedemptionDescription(affectedItem));
it should be
redemptions = new List<RedemptionDescription>() { new RedemptionDescription(new AffectedOrder(orderForm)) };
Hi,
It should return the items which the promotion applies to. For an order promotion you can return this:
return new PromotionItems( promotionData, new CatalogItemSelection(null, CatalogItemSelectionType.All, true), new CatalogItemSelection(null, CatalogItemSelectionType.All, true));
I have just upgraded EPiServer Commerce from 9.8.1 to 9.15.0. I am using custom promotion and found that API for promotions has been changed.
Here is the current code for custom OrderPromotion:
There is one new method to override "GetPromotionItems" I don't know how to use - just returning null.
Another change compared to previous version is that instead of afftected items RewardDescription expects RedemptionDescription sequence. RedemptionDescription constructor can take 1 or more affected items. I am just mapping affected item to RedemptionDescription one to one.
I went through with debugger and seems that Evaluate method is executed correctly. GetPromotionItems method is never called. But discount doesn't get applied on the order anymore. Previous version work perfectly.
What am I missing?