cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to retrieve coupon code from PromotionResult when Promotion has multiple conditions?

Former Member
0 Likes
1,304

Hi everyone!

So, I know I can retrieve coupon codes applied to an order by using order.getAppliedCouponCodes() but it won't tell me which promotions applied them so what I did was this:

  1. Collect Promotion results by calling: order.getAllPromotionResults();

  2. Extract AbstractRuleBasedPromotionActionModel from each ProductResult

  3. Take the first element from the actionModel using getUsedCouponCodes() method

This works great when the promotion conditions only include Coupon Code but if they are inside a Group condition, getUsedCouponCodes() method always returns null even if the promotion was actually triggered by redeeming the coupon.

I also tried (unsuccessfully) using PromotionResultService, which includes a method to retrieve coupon codes by PromotionResult:

 Optional<Set<String>> getCouponCodesFromPromotion(PromotionResultModel var1)

Does hybris 6.6 have a way to retrieve the coupon code given above scenario (Group conditions)?

Thanks!

Accepted Solutions (0)

Answers (0)