Skip to content

Add Coupon Codes to Email

Jacob edited this page Aug 28, 2015 · 1 revision

Add Coupon Codes to Email (v0.4.0)

(This feature requires magento version 1.7+)

Setup the shopping rule

It is relatively straight forward to insert auto generated coupon codes to your emails. First go and create a new shopping cart price rule. There is good documentation available on how to set up price rules, including video tutorials like this one from CreatingaWebstore.

Assuming you have setup your rule, you need to make sure you enable ”Use Auto Generation” for coupon codes.

Magento Coupon Auto Generation

When done, save your price rule and remember its ID. You can retrieve it from the url address.

Insert coupon to email

Once you have created your price rule, go to your email campaign and click on the text segment where you want to insert your coupon. Change into source mode and start typing the auto complete should give you an option.

Insert coupon code to email

Or copy past the following snippet your self: {{coupon rule="32" length="8" expire="120" prefix="ABC-" }}

Now you only have to replace the rule-parameter with your rule id (here 32) from the above step. This is really all you need to do, a coupon code will now get generated with every email. You can insert more than one coupon, generate two, one for your customer and one for his friend. You can also do AB-Testing using different coupons and see what works best.

Before I let you go, I still want to quickly show you the available parameters. Same as in the Magento price rule admin, you can define the look of the coupons. Here is a list of all available parameters and their default values.

  • rule= - [required] The rule id you want to associate the coupon with. Make sure the rule is active and enables ”Use Auto Generation” for coupon codes.
  • length=8 - the length of the coupon code, this should be at least 5 better more. Remember you want to create unique coupon codes and for that you need some digits. The extension will make the coupon length longer automatically if it has trouble creating a new unique code with the length defined. So the length really is a minimum limit.
  • expire=120 - How long this coupon code is valid in hours from the moment it is generated (not send). For instance 120 (24*5) make the coupon code valid for 5 days.
  • format=alphanum - The format you want to use, available options are alphanum, alph or num. Default is alphanum.
  • prefix="" - A prefix that gets prepend to the coupon code.
  • suffic="" - A suffix that gets append to the coupon code.
  • dash="" - A dash will insert a separator every x character. For example dash=4 could look like XXXX-XXXX-XXXX-XX.
  • delimer="-" - When dash is defined then the character to use as separator.