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:
How to configure the promotion using Moqui’s entities.
Setting up the conditions for the promotion to trigger.
Linking the discount action to Product A.
If anyone has examples, best practices, or documentation references, it would be greatly appreciated!
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.