Question

I'm trying to create a coupon code for a customer that gets a fixed value from PHP (essentially it can be a different amount for each customer/instance of generation).

For the coupon code generation, I created a rule and used the code available here: https://mage2-blog.com/magento-1-programmatically-create-promotion-coupon-codes/

The only issue is that it seems the value must be set in the rule.

Is there a way to create coupon codes according to a rule but with different values, or do I need to create a rule as well each time I want to run this?

Was it helpful?

Solution

You pretty much came to the correct conclusion. If you've got different values you need separate rules.

However if you've got same amounts you can generate codes which share rules.

The way I explain it is having rules for 10 off and 20 off. Each customer you want to give 10 off you generate a 10 off code. 20 a 20 off code.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top