If a customer buys product A, I would like to offer them a coupon code that allows them to get 10% off of a complementary item, product B. But, they must use the coupon within 30 days of the purchase of product A.
So, as an example, a customer buys an iPhone. After the purchase, they get an email that says "come back and buy an iPhone accessory and get 10% off, expires in 30 days". We don't sell iPhones, but this is just to illustrate the requirement.
I don't see where a specific coupon code can have its own expiration date. It looks like expiration dates are set on the rule, not the coupon code.
What's the best way to accomplish this?
That is correct. There is no way in Magento by default to auto-generate a coupon code for every new order.
In order to implement that feature, you should create an observer for the "place order" action. Then, that observer should run a custom code in order to generate a coupon code for that specific customer that expires 30 days from that specific time.
We have Community 2.1.0 and I'm trying to figure out how to set a timeframe expiration date to auto-gen coupons. Right now we have coupons being auto-generated for customers who leave a review. How do I set it in Magento that these coupons expire 30 days after they are issued?