Try our conversational search powered by Generative AI!

Promo Engine Error with DistributeMoney


We are running into an issue with the promo system.  We have the following scenario:

First Promotion Code For All Users

-Minimum $200 spend

-After applied, customer receives $0.01 discount to current order and receives an email with second promotion.

Second Promotion Single Use Code

-$75 off of another $300 minimum order

After applying the First Promotion Code, users that are eligible are occasionally running into the following error.  This isn't happening with all products/quantities but is reproducible with the same combination of SKUs.

System.InvalidOperationException: DistributeMoney called with too large remainingDiscountAmount (0.01)
at EPiServer.Commerce.Marketing.DiscountUpdater.DistributeMoney(IEnumerable`1 entries, Decimal remainingDiscountAmount, Currency currency, Boolean distributeOrderDiscount)
at EPiServer.Commerce.Marketing.DiscountUpdater.UpdateLineItemDiscount(IEnumerable`1 prices)
at EPiServer.Commerce.Marketing.PromotionProcessorContext.UpdateDiscounts()
at EPiServer.Commerce.Marketing.PromotionEngine.Run(IOrderGroup orderGroup, PromotionEngineSettings settings)
at EPiServer.Commerce.Order.IOrderGroupExtensions.ApplyDiscounts(IOrderGroup orderGroup, IPromotionEngine promotionEngine, PromotionEngineSettings settings)

We are on the following versions:

CMS UI - 11.17.1
CMS Core - 11.11.2
Commerce - 12.17.0

Any ideas?

Aug 26, 2019 15:59

The comment for the line throwing the exception you see, is like this

// This is a "should never happen" condition - ensure that we don't get stuck in an infinite loop. The situation is where we have a remaining
// discount amount that is greater than any of the remaining price entries values. I e we have a complete breakdown somewhere in the logic.
// This was exposed by one of the integration tests with improper setup.

before this was removed in Commerce 13.

So this is likely a problem with your processor and/or price set up. Without such information it's impossible to help you here. Your "recommended" solution is to upgrade to Commerce 13. Otherwise, you can follow up on the ticket that you opened with developer support service.

Aug 26, 2019 16:52
* 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.