cancel
Showing results for 
Search instead for 
Did you mean: 

Get real cart subtotal for cart promotion

Former Member
0 Kudos

I wrote a condition for a cart promotion in a new promotion engine. According to it, if cart subtotal is greater than ,for example, 80, apply a discount to cart. (cart subtotal is assigned in a custom RAO populator)

I have also product promotion together with the cart total. According to the product promotion, if the product is added to cart, apply a discount on the cart.

My problem is that if I have product promotion with the cart promotion, cart subtotal remains unchanged and cart promotion applies according to old subtotal.

Let me give an example.

Prod Promotion: P1 discount %50 on the price of same product ( Let the normal price of the product be 100 )

Cart Promo: C1 discount 10$ on cart when cart subtotal is greater than 100.

When I add it to cart, my old subtotal is 100 but actually is 50 before the cart promotion applies. So it is wrong.

I want to know real cart subtotal in cartRAO in order to apply cart promotion properly.

How to solve my problem?

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member702005
Participant
0 Kudos

Hi Hatip, This is very strange, because this is exactly the same scenario I have setup when I was making screenshots from the Out Of The Box accelerator and it works correctly for my Hybris 1808 version. It correctly picks up the reduced cart total and doesn't apply the cart promotion if the discounted product doesn't get above the treshold. I noticed some issues with the rules being fired when I had wrong currency set in the cart rule. Could that be your case? Other than that, can you try that on a clean accelerator storefront and check if the same setup works?

Former Member
0 Kudos

Hi Łukasz,

My Promotions:

1)productPromo

RuleGroup: orderPromotionRuleGroup

Priority: 2000

Rule: Contains any of the product Apply %50 discount on the qualifying products

2)orderPromo

RuleGroup: orderPromotionRuleGroup

Priority: 2

Rule: cart total price greater than 650 Fixed 20 tl discount

I just waited that after product promotion applied, orderPromo should not be applied since cart total changed (from 651 to 325) and in the rule of orderPromo(>650) cart total(325) is less than 650. It took old cart total(651) and applied. I deduce that cartRAO did not update after the product promo applied. That is exactly my problem. You can check the attached screenshot.

former_member702005
Participant
0 Kudos

I think my answer is still valid - your solution should be to check the priorities of your rules. As the documentation here states:

Although, the Promotion Engine applies the rules and their actions in the specified priority, discounts are applied by the cart calculation, which runs after the Promotion Engine has finished. The cart calculation always applies product-related discounts before order-related discounts.

This makes a difference for order-related percentage discounts. If, for example, an order percentage discount rule is applied to the order as the first rule according to its priority, and then one or more product-related discounts fire, the cart calculation applies the product discounts first and later on applies the order-level percentage discount. It makes a difference if a 10% discount is applied to the order total before or after the cart total has been reduced by product discounts.

For your case I guess, the issue is not with percentage of cart total, as you have a fixed discount, but I think your cart discount is never fired because of the different priority sequence. In my previous example when I reversed the priorities, the cart discount was getting applied with 1 item in cart even though it was discounted to 50GBP.

former_member702005
Participant
0 Kudos

Also, please note this sequence diagram [https://help.hybris.com/1808/hcd/loiob255ded07f144f83bb7f397beb8f2986_LowRes.png] that shows the cart is recalculated and RAOs are updated after each rule execution so it makes a difference in which sequence they are run.

Former Member
0 Kudos

Thank you Łukasz for your nice explanation but I would like to learn the best approach about how I take last and updated cart total price after some product promotions apply to the cart. I thought that CartRAO must be calculated again after applying product promotions before cart promotion applies. Is there any good practice to calculate CartRAO for my case?

Note: By the way, product promotions and cart promotion must be applied at the same time but product and cart promotion,respectively. You could check the example in the question.

former_member702005
Participant
0 Kudos

You probably need to change the rule priorities and make sure they're assigned to the same promotion rules group. Please see the attached screenshot. Note that the rule with a higher number in the priority column will get fired first (which might be confusing sometimes). In my example the rule with priority=2, which is product discount, gets fired before the rule with priority=1 which is cart discount.

In the storefront it works as below (only product promotion triggered for cfter discount lower than 100GBP):

former_member702005
Participant
0 Kudos

and both promotions fired if I add 2 items and have cart total after product promotions equal to 100GBP: