How to Create a Discount on next purchasing for purchasing a specific product in Moqui Promotion System?

Hello everyone,

I’m working on setting up a promotion in Moqui where customers will receive a discount if they already purchased a specific product (Product A). If Product A is purchased already they will get a discount on any product when they try to buy again.

Could anyone guide me on the best approach to implement this? Specifically:

  1. How to configure the promotion using Moqui’s entities.
  2. Setting up the conditions for the promotion to trigger.
  3. Linking the discount action to Product A.

If anyone has examples, best practices, or documentation references, it would be greatly appreciated!

Thank you in advance!

To create a new type of promotion, you will need to write code. This is what you need:

  • A ProductStorePromotion connect to the store(s) you want
  • A ServiceRegister connected to the ProductStorePromotion
  • A Service connected to the ServiceRegister that implements

Once you have those in place, on every major order change where the promotions are not disabled the mantle.product.PromotionServices.apply#OrderPromotions service gets called and evaluates to see if your ProductStorePromotion’s Service should be called.

An example of this is the 20% Discount for New Customers ProductStorePromotion with the NewCustomerDiscount ServiceRegister that then calls the apply#NewCustomerDiscount.

Let me know if you have any questions

1 Like