Magento – Get a coupon code to send in welcome email

coupon-codesshopping-cart-price-rules

Sales team created a shopping cart price rule with about 100 coupons. When a new customer signs up, I need to send one coupon code from this list in email. Each coupon is 1 time use only so need to send different code for each sign up. I dont want to look for the coupon codes by the rule name as it might change in the future. How can I grab unique coupon code for each sign up?

Best Answer

If you've already generated the codes and associated them with a rule, you can look the code up by the rule id. We recently did something similar but had the codes auto generated based on rule id - I found this extension helpful:

http://www.magentocommerce.com/magento-connect/newsletter-subscription-with-free-gift-coupon.html

It may not be exactly what you're looking for, but you could modify it to suit your needs.