November Happy Hour will be moved to Thursday December 5th.

Decrease product amount when promotion is added with larger amount then subtotal

Vote:
 

Hi,

We ran into a problem.

We have a site where you can use your wallet value to buy some products. The Wallet value the customer wants to use do we call a Wallet Promotion.
The customer selects the Wallet amount (max amount of order subtotal ex vat or max of customer wallet amount) en after that we create a Promotion of type WalletPromoData (override from OrderPromotion). 

Now we have the following scenario:

  1. Add product to cart with 4 seats a E200,- each (order subtotal is E800,-)
  2. Use Wallet value for whole order, so also E800,- (promotion with couponcode is generated and visible)
  3. Decrease the seats to 2, so order subtotal will be E400,- while the Wallet Promotion still has a value of E800,-
  4. Now, the cart page run into the following error after calling OrderRepository.Service.Save(cart): "Invalid order group total calculation"
  5. So it looks like Episerver doesn't decrease the amount of the promotion to the max of the order subtotal

Does anyone else ran into the same problem or something like this?

Thanks in advance.

Grtz Sander

#225646
Edited, Jul 22, 2020 12:36
Vote:
 

It looks like the promotion is triggered, but the amount in the cart would become -400, which is, of course, invalid? I think for what you want to do, a giftcard like implementation would be  a better solution. There is a sample implementation in Foundation

#225675
Edited, Jul 23, 2020 7:13
Vote:
 

Hi Jeroen,

Thanks for your answer, but this is not what we are looking for.
We use the WalletPromoData as a discount on the subtotal of the order, instead of a default coupon code.

Maybe we can have an email conversation or something like that to describe the situation better?
I'm from the Netherlands as well.

#225826
Jul 28, 2020 7:31
Vote:
 

Hi Sander, it's probably better to describe it here so others can chime in, as I am kinda swamped with work. But from what you are describing, you can't really use a promotion for it as you can't decrease the "value" of a promotion. Or you can set the minimum amount spent to trigger the promotion to the value of the "WalletPromoData"?

#225833
Jul 28, 2020 9:40
Vote:
 

Hi, finally we fixed it by running the promotion engine after the promotion was updated:

 try
            {
                var promotionUpdated = WalletManager.UpdateWalletPromotionsInCart(Cart, GetProductsInCart());
                if (promotionUpdated)
                {
                    var promotionEngine = ServiceLocator.Current.GetInstance<IPromotionEngine>();
                    promotionEngine.Run(Cart);
                }

                OrderRepository.Service.Save(Cart);
            }
            catch(Exception ex)
            {
                throw;
            }

            // Evt nogmaals RunCartWorkflows aanroepen
            return RunCartWorkflows();
#227134
Aug 28, 2020 9:00
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.