I have 3 types of coupons on my site, 2 of them are contrib(fixed amount and percentage amount) and 3rd one is custom(pretty much copy of percentage). I need to make sure, that only one coupon of custom type can be active at given time. Which hooks should I use to make sure that when one coupon of custom type is made active, the other one becomes not active?

Thanks in advance

1 Answer 1


My solution is as follows.
1. Check if entity created is a coupon and that coupon type is the one im checking using hook_entity_insert and hook_entity_update
2. Check if coupon changed or inserted has been put active if yes then load all other coupons of right type and turn them inactive

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.