No results were found...

Blog

How to send automated coupon code emails from WooCommerce and Shopify

· 25 min read · E-commerce,Automation · Feb 19, 2025
Remis, CPO

Gone are the days of clipping coupons from newspapers—today, consumers are copy-pasting their way to discounts. 

Offering a special discount in exchange for an email address is a super effective tactic for growing your email list. Not only does it help you increase conversions, but it will also help you build a list full of subscribers who like what you have on offer. 

We came across this video from MailerLite user and creator Larry Snow (thanks, Larry!) and wanted to share our own take on sending coupon codes with a written guide. In this article, we’ll show you some different methods of using an integration platform to trigger coupon code emails from WooCommerce and Shopify when someone joins your list.


Offering an incentive to join your list and make a purchase is a winning tactic on multiple fronts. You’ll increase sales by encouraging on-the-fence customers to hit buy, plus grow your audience with high-value subscribers who are already interested in your products. 

Manually sending out discount codes is fine when you have one-off or time-limited promotions. Incentive-based coupon codes, like welcome discounts, should be automated so subscribers instantly receive a code in their inbox, without you needing to lift a finger. It makes the whole process much easier for you. Plus, it increases the chances of a purchase by delivering the coupon code when the customer wants it most, and they are primed with a full cart ready to check out.


There are a few different ways you can send discount codes to new subscribers, and we’re going to outline 3 of them, ranging from the most simple to the slightly more complex (although even the most complex method can be achieved without significant technical skills!).

Note: For all of these methods, you’ll need the WooCommerce or Shopify integration to connect your store with MailerLite. For WooCommerce, you’ll also need the MailerLite Signup Form plugin for WordPress if you want to embed forms and pop-ups.

What you'll need
  • MailerLite account

  • WooCommerce/Shopify account

For this method, we’ll create a single discount code in WooCommerce and Shopify, and then create an automation that is triggered whenever someone joins the email list, so that they receive the discount code. 

Step 1: Create a group in MailerLite 

a) Create a group for your subscribers to be added to by heading to Subscribers > Groups and clicking Create group

The MailerLite app with navigation for creating a group highlighted.

b) Enter a name for your new group and click Create.

The Create group modal window for entering a group name.

Step 2: Create a new form or pop-up to collect subscribers

a) Go to Forms and select Pop-ups or Embedded forms. Then click the Create button. 

The MailerLite app with navigation for creating a form highlighted.

b) Assign the group you created before to the pop-up or form and start designing—don’t forget to write a success message too!

Example of a pop-up form created in MailerLite with a success message.

c) Click Done editing and set the options for your pop-up or form then click Save changes. You will be shown the JavaScript tracking snippet that you can paste into your website to show the form. If your store uses WooCommerce (WordPress) or Shopify, this snippet will be added automatically via the integration. 

d) Click Continue, you’ll be taken to the form’s page where you can enable the form or pop-up, as well as double opt-in (we highly recommend you enable this).

Step 3: Add your form to your WooCommerce or Shopify store

For WooCommerce/WordPress:

a) From your WordPress dashboard go to MailerLite > Settings. Click Enable for MailerLite Popups (if you are using pop-ups) and Double opt-in.

MailerLite form options in WordPress.

b) To add an embedded form, go to MailerLite > Signup forms and select Embedded forms created in MailerLite. Click Create form, enter a name, and select the signup form you created in MailerLite from the dropdown. 

MailerLite form selector in WordPress.

c) Click Save form. You can use the auto-generated shortcode to embed the form on any page. 

For Shopify:

a) Go to the MailerLite plugin settings and enable pop-ups.

The MailerLite plugin settings in Shopify with the pop-up options highlighted.

b) To add an embedded form, you’ll need to add the form manually. First add the JavaScript tracking snippet in the <head> section of your website, and then copy the code for your form and insert it where you would like the form to appear. 

Example of a form JavaScript snippet in MailerLite.

Step 4: Create your discount code 

For WooCommerce:

Make sure you’ve enabled coupons by going to WooCommerce > Settings > General > Enable coupons and ticking the Enable the use of coupon codes checkbox.

Then, to create a new coupon, in WordPress go to Marketing and Coupons. Click Add new coupon, enter the settings for your discount code, and click Publish. 

You’ll then be able to view your discount code in the Coupons section and copy the code into your email.

The coupon codes view in WooCommerce.

For Shopify:

Go to Discounts and click Create discount. Select Amount off order (Order discount) and the Discount code method, then fill in the settings for your code and click Save discount. Your code is now active and you can view it in Discounts.

Tip: Create a customer segment for number of orders less than 1, so you can ensure that only new customers are eligible. 

Step 5: Create your coupon code automation

a) This is the fun part! In MailerLite, go to Automation and click Create.

b) Choose an automation template or create an automation from scratch. For this example, we’ll choose the Simple welcome email automation. 

c) For the trigger, set When subscribe joins group and select the group you created and connected to your forms. You can also exclude customers who have already made a purchase so they don’t receive the email.

d) Next, add an email to your automation. You can use a previously created template or create a new one. Make sure you include your discount code in the email.

An example of creating a coupon code email in the MailerLite Drag and drop email builder.

e) When you’ve finalized your email, click Save and you’re ready to enable your automation. 

An example of a simple welcome email automation flow with a coupon code email in MailerLite.

That’s it! New subscribers who sign up to your list will now receive the welcome email with your discount code. 


What you'll need
  • MailerLite account

  • WooCommerce/Shopify account

  • SureTriggers account with Pro plan or above (you can use another integration platform, like Zapier, but the steps may be different)

Generating a single code to share with everyone is the easiest and most convenient method, and a lot of e-commerce business owners do just this. But if you’re looking to send unique coupon codes to each subscriber, you’ll need to set up a workflow for an email to be populated with the code before it’s sent. 

This method is often used for specific types of campaigns, such as birthday discounts. It can also help you to prevent people who haven’t subscribed to your list from using a general discount code.

For this method, we’ll assume you’ve already set up the WooCommerce or Shopify integration and a SureTriggers account, as well as your MailerLite groups, pop-ups, and embedded forms.

Before you get started…

To connect your MailerLite account, you’ll need to create an API token. In MailerLite, go to Integrations and click Use for API and then click Generate new token. Copy your API token and enter it in SureTriggers when prompted to connect your account.

The Create new API token modal window in MailerLite.

You’ll also need to create a new field for your coupon code. Go Subscribers > Fields and click Create field. Enter a name for your field and choose Text as the type. The name of the field will be used for the coupon code variable in the email.

Step 1: Create a new workflow in SureTriggers

a) Create a new workflow in SureTriggers 

b) Click Add trigger, and search for MailerLite

c) In the Select event dropdown, choose Subscriber Added To Group and then choose your MailerLite account or connect it. Click Continue.

Steps in SureTriggers for connecting MailerLite.

d) Select the group you created for new subscribers to set it for the trigger and click Continue

Option to select the MailerLite group in SureTriggers.

e) Test the trigger by adding a subscriber to the group (use a test email). The data for the subscriber should be automatically fetched into SureTriggers. Click Save

A successful test of the MailerLite connection in SureTriggers.

f) Click the + sign to add an action. Search for WooCommerce. In the Select Event dropdown, choose Create Coupon

g) Choose your WooCommerce Account or connect it and click Continue. You’ll need to add the SureTriggers plugin to WordPress to connect your account. Check out the video below to see how.

h) Next, configure the coupon code action. In the Coupon Code field, leave it empty and an 8-digit code will be automatically generated. Test your action and click Save.

i) Click the + sign again to add another action and search for MailerLite. Under Select Event, choose Add/Update Subscriber, select your MailerLite account connection, and click Continue

k) Configure the details, being sure to select the group you made earlier as well as the correct data for the subscriber’s email address. You should also see a field labeled with the same name you gave the field you created in MailerLite. In this field, enter the Coupon Code data you created with the previous action step for WooCommerce.

The action step configuration in SureTriggers showing the Coupon Code data.

l) Click Continue and test the action. Once the test is complete, head MailerLite to view the details for the subscriber you’ve tested. You should see that the field you created has been populated with the coupon code. 

Generating coupon codes using SureTriggers and Shopify is a little more complex and more steps are required. There is no simple and direct way to create unique coupon codes in the workflow as there is with WooCommerce, but we came up with a little workaround that seems to do the trick.

Before getting started…

You’ll need to create a new discount in Shopify. 

Go to Discounts and click Create discount. Select Amount off order (Order discount) and the Discount code method, then fill in the settings for your code and click Save discount. Your code is now active and you can view it in Discounts.

Tip: Create a customer segment for number of orders less than 1, so you can ensure that only new customers are eligible.

Step 1: Create a new workflow in SureTriggers

a) Create a new workflow in SureTriggers 

b) Click Add trigger, and search for MailerLite

c) In the Select event dropdown, choose Subscriber Added To Group and then choose your MailerLite account or connect it. Click Continue.

The steps in SureTriggers to connect MailerLite.

d) Select the group you created for new subscribers to set it for the trigger and click Continue

Option to select the MailerLite group in SureTriggers.

e) Test the trigger by adding a subscriber to the group (use a test email). The data for the subscriber should be automatically fetched into SureTriggers. Click Save

A successful test of the MailerLite connection in SureTriggers.

f) Click the + sign to add an action. Search for the Formatter app and for your event choose Text

Select the Truncate action and in the Enter text field, type @ and find the Subscriber ID to select it. 

In Max Characters enter your preferred number of characters to use for the discount code. We went with 5 for our example. 

We want to use the final 5 characters of the Subscriber ID, so in the Skip Characters field, we’ll enter a value of 13 as there are 18 characters in total.

The Formatter app options in SureTriggers.

Click Continue. Test your action and the step should return a value of the final 5 characters of the subscriber ID. Click Save.

g) Back in your workflow, add another action and search for Shopify. In the Select Event dropdown, choose Create Discount Code.

h) Choose your Shopify Account or connect it and click Continue.

Connecting your Shopify account

To connect your Shopify account, you’ll need to enter your store’s domain and an Admin API Access Token. 

  1. To generate an API key, click on Apps in the Admin dashboard. 

  2. Select App and sales channel settings and then click Develop apps

  3. Click to Allow custom app development and then click Allow custom app development again.

  4. Click Create an app, enter a name and click the Create app button.

  5. In the API key overview, click Configure admin API scopes.

  6. Find the Discounts access scopes and check the options for write_discounts and read_discounts. Click Save.

  7. Click on the API credentials tab and in the Access tokens section, click Install app. Click the Install button.

  8. Reveal and copy your API access token and paste it into SureTriggers. Click Connect Shopify.

i) Next, configure the coupon code action. In the Select Price Rule dropdown, choose your discount code price rule that you set up in Shopify. 

j) In the Discount Code field, type @, find the Format app data from the previous step, and select the result. Next to this, type -welcome. This will create a new discount code using the last 5 digits of the subscriber’s ID plus -welcome: 29004-welcome. You can customize this however you like.

The coupon code action step set up in SureTriggers.

k) Click Continue then test your action and click Save. You can also check that it worked by going to Shopify > Discounts, opening the discount you used for the workflow and clicking on View all codes. You should see the code that was created listed there. 

A view of our coupon codes in Shopify with the newly created coupon code displayed.

l) Click the + sign again to add another action and search for MailerLite. Under Select Event, choose Add/Update Subscriber, select your MailerLite account connection, and click Continue

m) Configure the details, being sure to select the MailerLite group you made earlier as well as the correct data for the subscriber’s email address. You should also see a field labeled with the same name you gave the coupon code field you created in MailerLite. In this field, type @, find the data from the Shopify action step, and select the coupon code data.

A view of the update subscriber action step options.

n) Click Continue and test the action. Once the test is complete, head MailerLite to view the details for the subscriber you’ve tested. You should see that the coupon code field you created has been populated with the uniquecoupon code. 

Step 2: Create your coupon code automation

In MailerLite, go to Automation and click New automation. You can create one from scratch or use a template. For this example, we’ll use the Welcome email template.

For the trigger, select Updated field. Choose the field you created for the WooCommerce coupon code and then select is provided. Click Save

The next step is to send an email. Create your email from scratch or with a template. Add the variable provided for your custom field where you want the subscriber’s coupon code to appear. You can find the variable in the Fields section in Subscribers.

An example of an email being created in the MailerLite Drag and drop editor with the coupon code variable.

Once you’ve finalized your email, click Save, enable your automation and that’s it! You’re now sending unique, automatically generated coupon codes to your subscribers from WooCommerce or Shopify.

The result showing the sent email with the unique coupon code displayed.
What you'll need:
  • MailerLite account

  • WooCommerce/Shopify account

  • SureTriggers account with Pro plan or above (or other integration platform like Zapier)

  • MailerSend account

If you prefer to send your discount code email as a transactional email, you can easily add MailerSend to a workflow to send them from there. 

The best thing about this solution is that you can connect your MailerLite account to manage access to both platforms from a single dashboard. And, since MailerSend is built for the super speedy delivery of important communication, you might find that emails get delivered even faster. 

To send your automated coupon code emails from WooCommerce or Shopify with MailerSend, you’ll set up your workflow in exactly the same way—the only thing we’ll change is where we send our email from. 

So assuming you’ve set up the steps before the email is sent, we’ll move into the final action step: Sending an email with MailerSend.

Connect MailerSend

a) Add another action step and search for MailerSend. Select the Send Email event and choose or connect your MailerSend account. 

To connect your account you’ll need to create an API key. In MailerSend, go to Integrations and click Manage in the API tokens section. Click create new token, copy the API key, and paste it into SureTriggers. Click Connect

b) Click Continue and then create your email. You can insert HTML code from a template or build an email from scratch. Remember to enter the correct subscriber email data, and insert the coupon code data from the WooCommerce action step where you would like the coupon code to be displayed in the email.

Creating an email in SureTriggers to send from MailerSend including the coupon code.

c) Click Continue and then test the action! You should find the email in your inbox, plus you’ll see it on the Activity page in MailerSend. 

The final result showing the email sent from MailerSend with the coupon code.

Try MailerSend for free

Sign up now and get a trial domain to test MailerSend out and get the Hobby plan with up to 3,000 emails/month free.

Sign up free

With the technical part out of the way, here are some key points to keep in mind when crafting your coupon code emails.

1. Keep your emails on-brand

Your discount code emails should be consistent in brand design and personality as all of your other emails. Staying on-brand helps to strengthen customer relationships, build trust, and keep your communication professional. 

In MailerLite, it’s easy to create on-brand email templates by setting your brand colors, fonts, and logo beforehand. Then all you have to do is craft your content and insert your welcome discount code or variable.

2. Use personalization where possible

Using subscribers’ names in the subject line and content make your messages feel more personal. You can go a step further and explore further personalization via segmentation to give customers offers that are tailored to their previous purchases or browsing behavior. This is a surefire way to increase conversions.

3. Craft clear and compelling subject lines

Using discount codes is a great tactic for increasing sales, but they’ll only work if your subscribers see them! Use your subject lines to let people know exactly what your email contains BUT avoid using overly-promotional or spammy language and punctuation. 

Keep it natural and aligned with your brand personality and subscribers won’t be able to stop themselves from checking out your offer.

4. Create a sense of urgency

Let subscribers know if their coupon codes have an expiry date, and emphasize that the offer is only available for a limited time in your subject line, headline, and body content. 

5. Test your automation

Using MailerLite and an automation platform like SureTriggers makes it super easy to create complex workflows without in-depth technical knowledge. That being said, there are many steps and a lot of complex mechanisms going on behind the scenes, so it’s important that you test out your automation from start to finish. 

6. Ensure maximum deliverability

By using email services providers like MailerLite and MailerSend, you’re already most of the way there! Make sure your email is properly authenticated with SPF, DKIM, and DMARC, and optimize your email content to ensure that it doesn’t raise any spam red flags. 

Check out more best practices in our email coupons guide!

Creating an automated workflow that generates coupon codes for your subscribers isn’t as scary as you might think. And with tons of automation platforms connecting to thousands of apps, the possibilities are endless. 

Give it a try and let us know how you did. We’d love to hear about your experience with other automation platforms or methods!

Amy Elliott
Amy Elliott
I’m Amy, Content Writer at MailerLite. As a child, I dreamt about writing a book and practiced by tearing pages from an A4 notepad and binding them with sugar paper. The book is pending but in the meantime, I’ve found a passion for telling a different kind of story-the brand story-by writing fun, valuable, human content.