Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Buy Products and Get Discount on Order double discounting

Vote:
 

Hi,

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

#193879
Jun 07, 2018 1:35
Vote:
 

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

#193882
Jun 07, 2018 8:44
Vote:
 

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

#194075
Jun 13, 2018 1:04
Vote:
 

You should use IOrderGroupCalculator.GetOrderGroupTotals instead. IOrderGroupTotalsCalculator was obsoleted 

#194081
Jun 13, 2018 8:55
Vote:
 

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

https://world.episerver.com/documentation/developer-guides/archive/commerce/orders/10-11/

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

#194289
Jun 19, 2018 4:05
Vote:
 

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

#194291
Jun 19, 2018 6:44
Vote:
 

Ok thanks for your help.

#194292
Jun 19, 2018 6:48
Vote:
 

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.

#194700
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.