Try our conversational search powered by Generative AI!

Rounding in promotions (Commerce 10.4.3)


Hi. Our customer has started making use of Episerver Commerce's campaign/promotion system, but they have a request from us, and I'm just wondering if this is something we have to make custom, or if there's built-in functionality.

When applying a percentage discount, the prices end up being "ugly." Say something costs 2499 and is given a 25% discount. Now the price shows up as 1874.25. That makes sense, since that's what 75% of 2499 is. But the customer wants to truncate the prices, so that the decimal places are gone, i.e. they want the resulting price to be 1874.00. Is there a way to easily get that outcome from the calculations?

Nov 03, 2017 11:32

If you want to round everywhere, not just with promotions, I guess you could add that logic to your price calculators (ILineItemCalculator, IOrderGroupCalculator, IOrderFormCalculator, etc). Decorate and round with your logic in the last place.

Nov 03, 2017 12:55

I just want to round with promotions. In particular, I want to round per item bought, so even if you buy 3 for 2499 @ 25% discount, I want the sum to be 7496 (i.e. 1874 * 2), and not 7497 (i.e. 1874.25 * 2). Regular prices, shipping, taxes, etc., should not otherwise be affected. And ideally, this should be possible to turn on and off. Am I right in thinking that I probably have to create my own IPromotionProcessor implementation to accomplish this?

Nov 06, 2017 7:09

Yes, sounds like it. A bit tricky, but you'll probably need to work with giving different monetarial reward descriptions depending on the result, so the end result will be rounded.

Nov 06, 2017 7:13
* 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.