Try our conversational search powered by Generative AI!

Buy Products and Get Discount on Order double discounting



We currently run Commerce V11.2.6.0.
Using the 'Buy Products and Get Discount on Order' discount we get a doubling of the discount that gets applied. First at the subtotal level and then also at the total.
For example, we set up a discount of this type at 10%:

Product 1: $50
Product 2: $50
Product 3: $50
Subtotal: $135 ($150 - 10% discount)
Tax: $13.50 (Australian so it's 10% gst)
Discount: $15
Freight: $10
Total: $143.50 ((subtotal + tax + freight) - $15 discount applied again)

We would expect: $158.5 as the discount has already been applied to the products.

To get the amounts we use IOrderGroupTotalsCalculator.GetTotals(cart); and we get the amounts above. There are no other calculations that we do in code that I know about. 

var result = new OrderTotals()
ShippingTotal = totals.ShippingTotal,
SubTotal = totals.SubTotal,
TaxTotal = totals.TaxTotal,
Total = totals.Total

The product discounts all work correctly, it's just the order discounts that appear incorrectly. Am I thinking about this incorrectly or is this a bug?

Cheers Ben

Jun 07, 2018 1:35

Is this a vanilla implementation - do you have any custom implementation with you promotion, promotion engine or your calculators?

Jun 07, 2018 8:44

Yes, this is a vanilla implementation. We have added nothing else around it.

Jun 13, 2018 1:04

You should use IOrderGroupCalculator.GetOrderGroupTotals instead. IOrderGroupTotalsCalculator was obsoleted 

Jun 13, 2018 8:55

We are using Commerce V11 and the documentation for 10-11 says that using IOrderGroupTotalsCalculator is the correct method.

I have attempted to use IOrderGroupCalculator.GetOrderGroupTotals but unfortunately its only available in 12+

Jun 19, 2018 4:05

That's true, I overlooked that.

I would suggest you to contact developer support service for further assistance. As it is right now I can't see why, we might need to look into your site for more insight

Jun 19, 2018 6:44

Ok thanks for your help.

Jun 19, 2018 6:48

I was able to look into your solution and after some debugging, you are using _lineItemCalculator.GetExtendedPrice(lineItem, currency); in your custom ShippingCalculator. ExtendedPrice include the order level discounts, that's why you are seeing double discount. You should have use GetDiscountedPrice - which only takes line item level discount into account.

Jun 28, 2018 12:32
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.