We are working with Episerver 10.8.0 and have a problem with discount.
I am using a promotion: Spend at least X amount and receive a discount off total order value. So I can get 10% off if I spend more then X$
In my implementation of ILineItemCalculator I have:
protected virtual Money CalculateExtendedPrice(ILineItem lineItem, Currency currency)
var itemPrice = lineItem.PlacedPrice * lineItem.Quantity;
var entryDiscount = lineItem.TryGetDiscountValue((ILineItemDiscountAmount x) => x.EntryAmount);
var ordreDiscount = lineItem.TryGetDiscountValue((ILineItemDiscountAmount x) => x.OrderAmount);
var num = (itemPrice - ordreDiscount - entryDiscount) * _priceHelper.GetFactor();
return new Money((num < 0m) ? 0m : num, currency);
When I run the code on a line item that cost 799 I get:
entryDiscount = -159.89
ordreDiscount = 79.9
When I only have discount on orders, I would expect to have:
entryDiscount = 0
My question is: What can set the entryDiscount?
Many thanks in advance
Are you using the builtin promotion, or a custom one? I am not 100% sure but i think your expectation is correct..
I am using a builtin promotion. I have try to find out why I am getting a entry discount but have not been able to find it. Do you have some ideas where I can look?
Your expectation is correct, there should be no entryDiscount here.
I assume you checked all active promotions (in case combine promotions). Have you set entryDiscount somewhere else in your implementation?
I only have one discount active.
We have made a opgrade from commerce 7.5 to 10.8, and opdatede the code to use the new promotion. Is there a way that I can check if we are runneing any old episerver promotion?
No the old promotions can't be run in conjuction with new promotions. they are mutually excluded.
Cast the ILineItem to LineItem and check the OrderGroupId and OrderFormId.
Then load the order group and on the right order form check IOrderForm.Promotions.
That should tell you all promotions that has been applied.