How to Create a Dynamic Coupon Code in Klaviyo

Joseph Hsieh

January 15, 2021

If your Klaviyo Account is properly integrated with your Shopify store, coupon codes created in Klaviyo will dynamically be created in Shopify. Coupons generated from Klaviyo will be unique for every recipient, so no two recipients will have the same exact coupon code to better enforce limit usage and sharing.

Create the Coupon Code in Klaviyo

To create a coupon code in Klaviyo, navigate to the “Coupons” section and click on the “Create Shopify Coupon” button.

how-to-create-a-coupon-code-in-klaviyo_01_new
Navigate to the “Coupons” section and click on the “Create Shopify Coupon” button

In the next step you should configure your coupon code.

In the first field you can name your coupon code. Note that the name you choose will later be used in the process of implementing the coupon code into your emails, so keep it simple and use a convenient convention.

In the “Prefix” field, you can enter a word that will be used as a prefix to your dynamic coupon code so that every coupon code will have this prefix. A prefix is a helpful way to identify the coupons when they are used in an order in Shopify.  In our example, we used “WELCOME-”. When a subscriber receives this coupon code, it will look like this “WELCOME-123ABC321”.

how-to-create-a-coupon-code-in-klaviyo_02_new
Fill in the name and the prefix for your coupon

The next part is configuring the “Discount Type”.

how-to-create-a-coupon-code-in-klaviyo_03_new
Select the discount type you want to offer with this coupon

There are 3 types of discount.

  • Fixed Amount
  • Percentage
  • Free Shipping

Select the type of discount you want to create and you can see additional options appear under the section where you can further configure your coupon.

For the “Fixed Amount” you can enter the amount of dollars you want to give as a discount in the “Value off” field.

how-to-create-a-coupon-code-in-klaviyo_04_new
For the “Fixed Amount” you can enter the amount of dollars you want to give as a discount in the “Value off” field

Additionally, you can select on which product or collection you want this coupon to apply. If you want to set a minimum threshold for the discount, you can check the “Require minimum purchase” checkbox and set the minimum amount.

The “Percentage” type is very similar to the Fixed Amount, where only difference is that in this case you’ll be setting a percentage discount of the total order value instead of a fixed amount of money.

how-to-create-a-coupon-code-in-klaviyo_05_new
For the “Percentage” you can enter the percent you want to give as a discount in the “Percent off” field

Again, you have the options to select on which product or collection you want this coupon to apply and set a minimum order value threshold for the coupon.

The “Free Shipping” is slightly different than the first two. Here you need to set a “Maximum shipping rate” for this coupon and “Country Eligibility”.

how-to-create-a-coupon-code-in-klaviyo_06_new
For the “Free Shipping” you need to set a “Maximum shipping rate” for this coupon and “Country Eligibility”.

The last part to configure is the “Active Dates”.

how-to-create-a-coupon-code-in-klaviyo_07_new
Configure the Active Dates

In the “Activation” section, you can set the coupon code to become active as soon as it’s sent or you can select a date on which the coupon code will become active.

how-to-create-a-coupon-code-in-klaviyo_08_new
Set the parameters for the coupon activation

The last part is setting the “Expiration” date. There are 3 options from which you can choose. If you select the first option, the coupon code will never expire. With the second option, you can set how many days the coupon code will be valid from the day the subscriber receives it. The third option enforces an end date for all codes generated for this coupon.

how-to-create-a-coupon-code-in-klaviyo_09_new
Set the parameters for the coupon expiration

After you finish configuring the coupon code, click on the “Create Coupon” button, and you should see your newly created coupon in the list of coupons.

how-to-create-a-coupon-code-in-klaviyo_07
After clicking on the “Create Coupon” button you should see your newly created coupon in the list of coupons

Using Klaviyo Coupons in Flows and Campaigns

Using the Coupon in Flows

If you use the Coupon in one of your Flow Messages, Klaviyo will automatically create coupon codes in advance and have them ready to send as new people enter the Flow. In the initial few sends from the Flow, you might experience a small sending delay.  This is because Klaviyo will generate the first coupon codes at the moment of sending the email. After a few emails are sent, Klaviyo will start creating batches of coupon codes and it will always have enough coupon codes ready to be sent.

Using the Coupon in Campaigns

Sending a coupon code in a campaign requires manually creating the coupon codes before the campaign is sent or scheduled. This is because the process of adding new coupon codes from Klaviyo to Shopify requires a certain amount of time. To generate new coupon codes click on the dropdown arrow of the coupon and click on “Add Codes”.

how-to-create-a-coupon-code-in-klaviyo_08
To generate coupon codes, click on the dropdown arrow and select “Add Codes”

Enter the number of codes you want to generate and click on “Submit”

how-to-create-a-coupon-code-in-klaviyo_09
Enter the number of codes you want to generate and click on “Submit”

How many coupon codes you will generate depends on the size of your audience for that campaign. Basically, you’ll need one coupon code for every subscriber that will receive the email so enter in a number equal or greater than your audience size.

Inserting Dynamic Coupon Codes in a Klaviyo Email Template

You can send coupon codes in Flow Messages or Campaigns. However, you first need to add a dynamic placeholder variable into the Email Template that will place your coupon code in the Email.

Use the following variable and replace the placeholder name with the actual name of your coupon:

{% coupon_code 'NAME_OF_YOUR_COUPON' %}

In our example it would be:

{% coupon_code 'welcome20' %}

Replace the coupon name from this example with the name of your coupon code and place this line of code into a text block where you want the coupon to appear. Remember, coupon codes can be added to wherever text can be added, this includes:

  • Subject Line and Preview Text
  • Image Blocks’ ALT Tags, and Links
  • Text or Source Input of Text Blocks, Table Blocks or Split Blocks
  • Button Blocks’ Labels and Links
how-to-create-a-coupon-code-in-klaviyo_10
Implement the variable in your email template as shown in the image

To see if you’ve configured the dynamic placeholder variable, you can preview your email and where the coupon code should appear, you should see the name of your coupon followed by “-PREVIEW”.

how-to-create-a-coupon-code-in-klaviyo_11
If you’ve successfully implemented the coupon code, on preview mode you should see the coupon name followed by “-PREVIEW”

In case you enter a wrong coupon name, you’ll see an error like this.

how-to-create-a-coupon-code-in-klaviyo_12
If you haven’t implemented the coupon code successfully, you’ll see an error message as shown in the image

If you want to create a link that will show the coupon code and it will automatically apply the discount on checkout, follow the instructions in this tutorial: How to Add a Link to Apply a Dynamic Coupon Code on Shopify Checkout.

Recent Posts

How to Disable or Enable the Double Opt-in Process in Klaviyo

What is "Double Opt-in" and how to disable it in Klaviyo.

How to A/B Test the Sending Time of Campaigns in Klaviyo

Learn how to A/B test the sending time of campaigns in Klaviyo.

How to A/B Test Subject Line and Content in Campaign Emails in Klaviyo

Learn how to A/B test your campaigns in Klaviyo.