Showing results for 
Search instead for 
Did you mean: 

Promotions - applying same promotion type multiple times

Former Member
0 Kudos

I have a requirement of applying promotions based on multiple thresholds.

Say for example fixed discount on order threshold. on 100$ -> 5$ discount, on 200$-> 20$ discount.

My order value is now above 200$ but since the order value is greater than the threshold on both occasions, the discount applied is 5$+10$ rather than 10$ alone.

I have defined a custom promotion class extending OOTB fixed discount promotion class and am checking for the threshold and am applying based on promotion results and the instance of promotions applied and then removed the all promotions of the current instance and apply the new one.

Is there a way to ensure only one valid promotion is applied.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sunil

As you already know the hmc allows you to set a priority when a promotion is created. This also applies for your custom promotion class. The platform evaluates all the defined promotions, starting with the promotion with the highest priority, and applies those which meets the conditions. It means, all the applied are valid.

For the requirement you have, only the promotion with higher priority have to be applied. One of the possible ways to accomplish this is to implement a custom restriction class, where you have to override the evaluate method and return a "RestrictionResult.DENY" if the evaluated promotion hasn't the highest priority.

  • First, you have to add a new item to your EXTENSION_NAME-items.xml file.

     <itemtype code="OrderPromotionHighestPriorityRestriction" extends="AbstractPromotionRestriction"                   jaloclass="de.hybris.platform.promotions.jalo.OrderPromotionHighestPriorityRestriction" autocreate="true" generate="true"/>
  • Build the platform.

  • Add the implemented method, evaluate, to the class, de.hybris.platform.promotions.jalo.OrderPromotionHighestPriorityRestriction. Please see the attached file, (java class).

  • Build the platform again and restart the hybris' server.

  • Now you have to update your extension.

  • Finally open the hmc and apply the restriction to all the promotions that you need to. You do this by making click on "Marketing" --> "Promotions". Then go to the promotion tab and click on create new [OrderPromotionHighestPriorityRestriction]

NOTE: If you want to create a localized label to show instead of OrderPromotionHighestPriorityRestriction, please see this trail

0 Kudos

Hi Santiago,

Thanks for the valuable solution.I am also facing the same kind of problem.

When I am trying to click the attached zip it is showing me the file not found.

If you can re-attached the zip, It would be great.


Answers (0)