We're on our way to upgrade EPiServer Commerce from 10.8.0.0 to 188.8.131.52 and are experiencing some problems with promotion calculations for order discounts (item discounts seems to be working as before). Totals and Subtotals differ, amongst other. I can't find any breaking change regarding this other than a blog post (which is subject to changes); https://world.episerver.com/blogs/Magnus-Rahl/Dates/2017/2/planned-breaking-changes-in-commerce-2017/
"Order Calculator Changes: Some default calculator implementations don't work as expected, for example they include order level discounts in the subtotal instead of the order total."
Could this be related to our issue and is the above implemented in the final release?
If you can post your promotion configuration, and the differences between 10.8 and 11.8.3, it would help us looking into this.
The promotion configuration is the same in both version, "Buy at least X items from catalog entries and get discount on order value." i.e. buy any product and get 15% off on the order.
But to your knowledge, is there something that has changed regarding the discount calculation on item-level (works in both our versions) vs. on order-level (does not work in our 11.8.3)? We have some custom calculators (CustomTaxCalculator, CustomShippingCalculator, CustomOrderGroupCalculator) which could be subject to change if so. For example in our CustomOrderGroupCalculator we override the CalculateTotal of DefaultOrderGroupCalculator like so:
protected override Money CalculateTotal(IOrderGroup orderGroup)
var total = this.GetSubTotal(orderGroup) + this.GetHandlingTotal(orderGroup) +
this._shippingCalculator.GetShippingCost(orderGroup, orderGroup.Market, orderGroup.Currency) +
this._taxCalculator.GetTaxTotal(orderGroup, orderGroup.Market, orderGroup.Currency);
var roundedTotal = total.Amount.RoundSis(total.Currency);
return new Money(roundedTotal, total.Currency);
if I include removal of the OrderDiscountTotal (this.GetOrderDiscountTotal(orderGroup, orderGroup.Currency)) from the total variable above, it seems to add up to the correct values. I suppose it's not the right way to solve this problem but maybe a hint to what the issue could be(?)
I discussed with my colleagues and it seems the changed behavior is from COM-2434 GetSubTotal methods use ExtendedPrice instead of DiscountedPrice. This is a sematic breaking change in Commerce 11 so we might have missed documenting it. I'll check with documentation team to add such information. Thanks for notifying us and apologies for the inconveniences.
I'm not quite sure I follow, should I solve the problem like suggested above by removing the OrderDiscountTotal from CalculateTotal?
From what I can tell, the new implementation of CalculateTotal takes the OrderDiscountTotal into account (it minuses the value returned by GetOrderDiscountTotal) before returning the result. I guess you would have to do the same in your custom implementation.
Ok great, thanks a lot for the quick response!