Guide to Using Coupon Codes in Klaviyo

Last updated at:


Find out how to create or upload unique and static coupon codes in Klaviyo by reading this article. 

Coupons or discounts can be a great way to bring your customers back if they haven't returned recently or to reward them for subscribing to your newsletter.

There are multiple ways to upload and use coupon codes in Klaviyo. This guide covers the following methods:

  • Generate unique coupons codes (for Shopify, Magento 1, and Magento 2 stores)
  • Upload unique coupon codes
  • Upload a single static coupon code for everyone

After you have your coupon codes set up, this guide outlines some ways to use them:

  • Add coupons to your emails and SMS
  • Display your coupons as barcodes for your brick-and-mortar stores
  • Set up coupon reminders for customers that haven't used a coupon code
  • See who used specific discount codes (Shopify and Magento 1.x stores)

Generate Unique Coupon Codes

Klaviyo can autogenerate unique coupons for Shopify, Magento 1, and Magento 2 stores.

Upload Unique Coupon Codes

You can generate your own set of unique coupon codes outside of Klaviyo, upload them to your Klaviyo account, and reference them in your campaign or flow messages. This is a useful method if you're using point of sale software that can generate and manage coupon codes. There are some important things to note when uploading coupons using this method.

  • Klaviyo doesn't maintain any metadata on your coupons. This means we don't know how much the code is worth, what the expiration period is, which restrictions there are on the code's use.
  • You are responsible for ensuring the validity and expiration dates that these codes will work at your point of sale system.
  • You can set an expiration date when adding coupon codes, but this date only applies to how long the coupon codes are available in your Klaviyo account. Please note that dates are in the UTC time zone.

Enabling Uploaded Coupons

First, make sure that uploaded coupons are enabled. To find this setting, navigate to Account > Settings > Profile Maintenance. Toggle on the Uploaded Coupons option. 

Enabling uploaded coupons in Klaviyo's Profile Maintenace page.jpg

Once you enable uploaded coupons, you will see a corresponding tab in Coupons

Preparing Your List of Coupon Codes

Next, prepare a list of your unique coupon codes. Each code should be unique. The list of codes should be saved in a CSV file with one column, where the header is Coupon or Coupon Code. Below is an example of what a list of coupon codes look like in a spreadsheet.

Example of 10 coupon codes in a CSV file that are ready to be uploaded

Uploading Coupons into Klaviyo

Next, navigate to Coupons and click the Uploaded Coupons.

The uploaded coupons tab in Klaviyo showing 0coupons

Click Create Uploaded Coupon to add a new coupon code. Provide a name for your coupon, and select an expiration date.

If you send a campaign or flow message without enough available coupon codes, then the messages will be skipped.

The Add Coupon button in the Uploaded Coupons tab in Klaviyo, which allows you to add more coupon codes

Click Add Coupon to save your coupon. You'll be taken back to your Coupons tab. Then, click the dropdown for your new coupon and select Add Codes.

The Add Coupon option is available in the dropdown on the far right side of the coupon.

Upload your list of coupons. You can drag and drop your file or select it from your computer.

Page to upload coupon codes via CSV, either dragging and dropping it into the page, or searching for the CSV in your computer

After selecting your file, review your coupons and then click Start Import.


After your coupons finish importing, you can see how many coupon codes uploaded successfully and how many were skipped because of duplicates or a lack of data.

Coupon upload creation screen, showing that the codes were uploaded successfully

Use Uploaded Coupons in an Email

You can now include your coupon codes in your emails. When editing an email, include the following snippet, replacing "coupon_name" with the name of your coupon:

{% coupon_code 'CouponName' %}.

You can only add one coupon code per email. You can display the same coupon code in multiple places, but you cannot use multiple codes.

Unique coupon codes are not supported within Klaviyo's signup forms. If you'd like to display a coupon in your form's success message, you must use a static code. 

Email example showing a single coupon

After sending your email, you can check the total coupon codes by clicking into the Coupons tab and checking the Available/Total column.

The Uploaded Coupon tab where you can see the coupon name, how many total codes there are, and how many are available

 When sending uploaded coupon codes in emails, if your send list is larger than your available coupon codes, then the messages scheduled will be skipped.

  • If the code is used in a campaign message, Klaviyo will compare the number of expected recipients to the number of available codes for the coupon used. A warning is displayed if there aren't enough codes available, and you are unable to send the campaign. When A/B testing, you will need enough available codes to cover the full send, even if your code is only being sent to a part of the list or segment you are sending to. 
    Error message indicating that not enough coupon codes are available
  • If the code is used in a flow message, Klaviyo will compare the number of expected recipients to the number of available codes for the coupon used. Flow emails that contain coupon codes with 0 available cannot be turned live. At send time, if a flow email contains a coupon with no available codes, the email will be skipped. You can see who was skipped by clicking into the analytics of the flow email and clicking Recipient Activity > Other.
    The skipped reason for no more uploaded coupons in an email's analytics

Send Coupons as Barcodes

If you also have brick and mortar stores, you can save your customers (and your cashiers) lots of time by providing a barcode coupon that can quickly be scanned at your point of sale system.

To display a barcode in an email template, use the following template tag:

{% barcode_code 'CouponName' height=100 width=200 %}

The height is measured in pixels and can be adjusted to serve the design requirements for your template.

Below is a preview of the email with this barcode.

Preview of an email with a coupon in a barcode

Some point of sale systems required you to add special characters to your coupon code before it is rendered into a barcode. If you need more control over the code before being rendered, adding the cut parameter to your coupon template tag removes a specific character or characters from all locations in the code displayed.

For example, let's say your point of sale system requires that you render your barcodes from coupon codes that begin with a hashtag. For your site, you need to remove this hashtag. You can use the cut parameter to pass one version of this code as a barcode, and a separate version that does not include the hashtag for your other code. For the code #GREATdoggo12345, the following tags display these values for a user:

{% coupon_code 'CouponName' cut=# %} == GREATdoggo12345
{% coupon_code 'CouponName' cut=G %} == #REATdoggo12345
{% coupon_code 'CouponName' cut=g %} == #GREATdoo12345
{% coupon_code 'CouponName' cut=5 %} == #GREATdoggo1234
{% coupon_code 'CouponName' cut=#Gg5 %} == REATdoo1234

The cut parameter has the following limitations:

  • This is case sensitive. For example, using cut=i will remove i but not I.
  • Multiple items can be combined with a single cut tag.

If you're using the cut parameter, ensure that you fully understand how characters are removed from your rendered code so that customers do not receive corrupted codes.

Use Coupons in an SMS Message

You can also use coupon codes in SMS/MMS messages. The process is almost the same as for emails and uses the same template tag for adding the code:

{% coupon_code 'CouponName' %}.

Swap out CouponName for the name of your coupon and add it to your flow or campaign message.

SMS with coupon for 20 percent off one item

The only difference with SMS is that only one coupon code can be added to a message; whereas with email, multiple coupons can be used. The reason for this is that with email, you have access to hidden blocks to send different coupons based on where someone lives or what they’ve done. If you try to add multiple coupons to an SMS message, you will see an error message.

Error message for when two dynamic coupons are in an SMS

Previewing Coupon Codes in Messages

Regardless of whether you're sending a coupon in an email, an SMS, or as a barcode, the preview will show the coupon name followed by "-PREVIEW." The preview does not show an actual coupon code, as this would use up one of your available codes each time you preview the message. 


Add a Single Static Coupon Code for Everyone

For small stores or for certain discounts, you may just want to paste the code straight into the SMS or email content being used. If you're worried about the code getting spread around the internet, you can change it every couple of months or set a small expiration window.

The first step would be to create a coupon code in your ecommerce platform. To use it in Klaviyo, drag and drop in a text block and type in the code. Make sure that the block is prominent so recipients will notice it.

Example email showing a single static coupon

Set Up Coupon / Discount Code Reminders

A great use of Klaviyo's automated flows is to automatically follow up with people who haven't used a coupon code to remind them about it. 

Add an additional email or SMS to the same flow that was triggered to give out the initial coupon, but set this additional message to go out a few days later.

For unique (also called dynamic) coupons, instead use either a split or an additional filter so that the follow-up message only goes to those who have placed an order zero times since starting this flow. 

For static or uploaded coupons, include an additional filter for this new message that checks whether or not that person has placed an order that used that discount code. Only allow this follow-up email to send if someone hasn't placed an order since starting this flow.

Setting a additional filter so only those who haven't used the coupon receive a reminder email

One person can only receive one unique coupon code per coupon. If you resend an email to one of your customers using the same coupon, they will receive the same unique coupon code.

See Who Used Discount Codes in Shopify and Magento

For Shopify and Magento stores, Klaviyo has the ability to pull in specific coupon codes being used for each purchase. This only works for static coupons or a singular unique coupon code; you cannot segment, split, or filter by a unique coupon code's name or prefix. 

This feature lets you easily create a dynamic segment of everyone who used a particular coupon code.

  1. Create a new segment and name it "Used a coupon".
  2. Select What someone has done (or not done) from the dropdown.
  3. Select the Placed Order event and then click the Add Filter option to specify the discount codes to select.

This is a great way to understand if coupons are getting forwarded on to others, shared among friends, etc.

If you are using a custom platform or a platform like Volusion, BigCommerce, Symphony, or others, you may also be able to pull coupon information. Use the Add Filter option to see if a "Coupon" or "Discount Codes" option appears.

Additional Resources

Klaviyo can autogenerate unique (or "dynamic") coupons. Learn more: 

Was this article helpful?
469 out of 778 found this helpful