You will learn
Learn how to create single-use coupon codes for your Shopify store so that each customer receives their own unique coupon code for a given promotion on your site. This feature provides an alternative to creating a generic, also known as a static, coupon code, so you don't have to worry about codes being shared.
Shopify enforces a limit of 20 million unique discount codes for each Shopify store. If you reach this limit, you will need to delete unique codes from your Shopify admin before Klaviyo can resume generating new unique codes.
Before you begin
If you have not already, read our guide on How to Integrate with Shopify for step-by-step instructions on integrating before continuing with this article.
Make sure that you’ve integrated with Shopify and can view the Coupons tab in your Klaviyo dashboard.
If you are having trouble accessing it:
- Navigate to the Integrations tab in Klaviyo
- Search for Shopify, and click on the integration to bring you to your Integration Settings page.
- Click Update Settings to update your integration settings (you may need to re-authenticate with Shopify to then be brought back to Klaviyo)
- Navigate back to your Coupons tab.
When to use unique coupon codes
Unique coupon codes can be using in email campaigns, flow emails, and SMS messages. Examples of unique coupon codes in campaigns include:
-
Discount codes for email subscribers
Reward your subscribers by sending them an exclusive, email-only promotion using coupon codes. -
Pre-sale discounts for VIP customers
Send your VIPs unique codes that they can use to purchase from a brand-new collection. -
Shipping delay discounts
If certain items are back-ordered or you're experiencing fulfillment delays, send impacted customers a unique code to thank them for their patience.
Examples of unique coupon codes in flows include:
-
Abandoned cart
Send a discount code to cart abandoners who haven't bought before that is only active for 2 to 4 days. This will create a sense of urgency and help convert casual browsers into paying customers. -
Winback
Send a discount to buyers who haven't purchased recently, incentivizing them to purchase again. Like with abandoned cart coupons, a code with a set expiry will create a sense of urgency and can prompt a purchase. -
Welcome series
Send new subscribers a discount code as soon as they join your email list — you can send another code with increased savings if they haven't bought after 2 weeks.
Klaviyo coupon codes only work for nonrecurring orders, and not subscription orders such as those enabled by Recharge.
Create your coupon code in Klaviyo
- Navigate to Content > Coupons in Klaviyo.
- Click Create Shopify Coupon in the upper right-hand corner.
- For each coupon, set the following properties in Klaviyo:
-
Name
Setting a name will help you identify the coupon in Klaviyo. Note that you will need to use this exact name when including the coupon in a message. -
Prefix
Klaviyo will generate a random code for each person, but you can also specify a prefix to be included in every code (e.g., WELCOME). -
Discount type
Choose whether the coupon is a fixed amount off, a percentage off, or free shipping. -
Free shipping
For free shipping coupons, you can limit the coupon so it only applies to certain shipping rates, or only to specific countries. -
Fixed amount and percentage
For coupons that offer a fixed amount or percentage off, you can specify that the coupon only applies to certain products or collections. -
Applies to
Pick whether customers can apply the coupon to the entire order, specific products, or specific collections. -
Require minimum purchase
Choose if the coupon can only be used if the customer’s cart reaches a specific amount. Note that if the code is only for a specific product, the minimum purchase amount only applies to that specific product.
-
Activation date
This is the date the coupon becomes active — you can choose a specific date or select an option where generated coupon codes activate at send time. Please note that dates are set in the UTC time zone, so you may see a different activation date in Shopify. -
Expiration
Choose when you would like your coupon to expire. There are different options for coupons used in campaign messages versus flow messages. Please note that, in Klaviyo, dates are set in the UTC time zone. However, Shopify sets the expiration date and time based on the Shopify store’s timezone, so you may see different expiration dates in Klaviyo and Shopify for the same coupon.- Campaigns
You have 2 choices for expiration- Generated coupon codes will never expire.
- If you want your discount to have a defined end date, after which generated codes will expire, you can select a specific expiration date.
- Flows
You have 3 choices for expiration:- Generated coupon codes will never expire.
- Generated coupon codes will expire after a certain number of days/hours.
- If you want your discount to have a defined end date, after which generated codes will expire, you can select a specific expiration date.
- Campaigns
-
Name
- Click Create coupon.
- Coupons that expire after a certain number of days/hours have variable expiration dates. Although you can create coupons with variable expiration dates for flows, you cannot create coupons with variable expiration dates for campaigns.
- Coupons set to never expire will still show an expiry date of 1 year listed in Klaviyo, however they will not expire.
Note that your coupon's actual expiration will always be 24 hours beyond what you set in the expiration date field. This is to ensure that the coupon can still be used by the recipient in case there is a delay in sending or delivery.
For example, if you set a 8/15/2024 at as the expiration date for your coupon, it will actually expire on 8/16/2024. Similarly, a coupon set to expire in 4 hours will still be valid for a 24 hour period after the initial 4 hours.
It's also important to note that if you update coupon settings, such as discount type and percentage, within Shopify, all codes generated with those price settings will have the new price settings. If you update coupon settings in Shopify that are not available in Klaviyo's coupon creation, those changes will not be reflected. See information on updating coupon codes for more details.
Generate codes after creating your couponGenerate codes after creating your coupon
Klaviyo generates coupon codes for flow emails automatically. If you plan to use your coupon in a flow you do not need to generate coupons manually and can skip this section; however, if you plan to use your codes in campaign emails, you must manually generate coupon codes.
Once you've configured your coupon's definition, you'll next need to specify the number of coupon codes that you want to generate for your campaign. This must be done before you schedule your campaign. To generate coupons:
- Navigate back to the Coupons tab.
- Click the 3 dot dropdown next to the coupon you just created and select Add Codes.
Coupons with variable expiration dates cannot be used in campaigns. As such, you will not see the option to manually add codes if you have selected a variable expiration date for your coupon.
- Keep in mind that:
- You must generate at least as many codes as expected recipients. This means that if you generate fewer codes than the number of estimated recipients, you will not be able to schedule or send the campaign.
- If your scheduled campaign is set to "Determine recipients at send time," and the actual number of recipients is greater than the number of codes you generate at send time, the extra recipients will be skipped and will not receive the email.
- If you generate a large number of codes, allow time between your campaign's desired send time and when you create the codes. Generating a large number of coupon codes may take up to several hours. Because of this, use the estimated number of recipients of the campaign as a framework and do not significantly overestimate the number of codes you need.
- Input the number of codes you would like to generate in the box and click Add Codes. Again, be sure to generate at least as many codes as you have expected recipients for your campaign, otherwise, you will not be able to send or schedule it.
- Klaviyo will begin generating coupon codes for your campaign. Monitor the progress bar that appears beneath the coupon name to display progress, or track the number of codes that have been created in the Available/Total column.
You are able to include multiple codes per email (but only 1 code per SMS). If you use multiple coupons in a message, make sure you have enough codes for every recipient to receive one of each code. With email, you have the option to use hidden blocks to send different coupons based on where someone lives or what they’ve done. If you add multiple codes to an email, shoppers will only be able to use 1 coupon per order as they cannot combine multiple codes on the same order. We recommend exercising caution with the hidden blocks feature because codes may be assigned to all recipients (even if they end up hidden in your message) and block your send if there aren’t enough codes.
Now that you've generated your codes, use them in an email campaign or SMS message to incentivize site visitors to make a purchase.
Using your coupon in a campaign emailUsing your coupon in a campaign email
After the coupon codes have been generated, you can include the coupon tag in your campaign template.
- Drag and drop a text block wherever you want the coupon to appear in your campaign.
- Add a coupon tag in the text block using the following format:
{% coupon_code 'NAME_OF_YOUR_COUPON' %}
- Replace NAME_OF_YOUR_COUPON with the coupon name (it must be an exact match of the name, including capitalization). Note that this should be the name of the coupon from the Name section in the Coupon Details (not the prefix).
- Save your changes.
When emails are sent out, this variable will be dynamically replaced with a unique discount code for each recipient.
Test your campaign's couponTest your campaign's coupon
Before you send out the campaign and coupon to your audience, we suggest testing first. To test the coupon in your campaign email, make sure that you have added codes from within the Coupons tab. As long as you have sufficient codes, you can send a preview email to yourself or a member of the team and a live code will be generated. Note that the code will not actually be used.
- If you preview the email directly in Klaviyo, you will not see a unique coupon code populate. It will appear as COUPON_NAME-preview.
- If multiple people are included in the preview send, they will all receive the same code.
Once you're ready to send or schedule your campaign, click Review & Send Campaign. Here, you will see a Coupon Codes area. If you have fewer coupon codes available than expected recipients, you will not be able to schedule or send your campaign and will need to add more codes.
After your campaign is sent, you can see which code an individual recipient received by navigating to their profile and scrolling to the Coupons section.
Using your coupon in a flow emailUsing your coupon in a flow email
Once you've created and configured the coupon, insert it into your flow email:
Because coupon codes for flows are replenished automatically, you won't need to manually add batches of coupon codes via the Add Codes option.
- Open up a flow email inside one of your flows.
- Add a coupon tag with the following format into your flow email template:
{% coupon_code 'NAME_OF_YOUR_COUPON' %} - Replace NAME_OF_YOUR_COUPON with with the coupon name (it must be an exact match of the name, including capitalization).
- Save your changes.
When emails are sent out, this variable will be dynamically replaced with a unique discount code for each recipient. If you use the same coupon tag within multiple flow messages, the recipient will receive the same unique code each time (until the code expires).
Unique coupon codes for live flow emails are generated automatically in batches of 100. When the number of coupon codes is depleted below 100, or if the price rule of expiration period change, Klaviyo will generate another 100 coupon codes. This ensures that there are always enough codes available for live flow emails, but it can also lead to a large number of coupons generated in Shopify as well as in the Total coupons tab in Klaviyo.
If your flow is connected to a list that you intend on adding a large number of contacts to, we suggest that you take a different approach and send the coupon code in a campaign instead. You will then need to add as many codes as the number of contacts that you will add to the list. This is especially important for large list uploads to ensure that your emails are sent in a timely manner.
Note that when you preview the email directly in Klaviyo, you will not see a unique coupon code populate. Additionally, you will not be able to preview coupon codes with variable expiration dates because you cannot manually add codes to these types of coupons.
Test your flow email's couponTest your flow email's coupon
Before you send our the flow and coupon to your audience, we suggest testing it first.
Test a coupon with a variable expiration date (e.g., 7 days)
- In the flow builder, click Review and turn on.
- Change the status to Manual.
- Click Turn on.
- Trigger your flow by performing the trigger action (e.g., filling out a sign-up form to join a certain list). Your flow will automatically generate 100 coupons upon you triggering the flow.
Note that the initial coupon may take about 3 minutes to generate. Because of this, there is a short loading buffer, and you may see your test profile under Skipped: Retrying Generating Coupon Codes. This will go away once the coupons have finished generating.
- When the coupons are generated, your test email that triggered the flow will be under Needs Review for the email.
- Click into the Needs Review bucket under Recipient activity.
- Select Send Now.
- Check your inbox for the email with the unique code.
Test a coupon with a non-variable expiration date (e.g., Never expire)
Manually add codes then send a preview email to yourself or a member of your team to generate live codes.
- Manually add as many codes as needed for testing purposes on the main Coupons page.
- Click into the flow email that contains the coupon.
- Click Preview.
- Once your test says Needs Review, you'll be able to manually send a coupon to your inbox. Note that if multiple people are included in the preview send, they will all receive the same code.
Any flow that contains a coupon that does not expire will send the same code to a customer each time they enter the flow path. If you expect a customer to navigate through a flow multiple times, you may want to use a coupon that expires so that each time they enter the flow, they receive a new code.
Using your coupon in a signup formUsing your coupon in a signup form
You can also use unique coupon codes for Shopify in your signup forms. Make sure to have a signup form with a coupon block created. You can create your coupon in advance, or directly when building your form.
On your form's coupon block, take the following steps to add a unique coupon for Shopify:
- Choose Shopify Coupon as your Unique Coupon Type.
- Click the dropdown next to Unique Coupon to either choose an existing coupon, or click the plus sign (+) to create a new Shopify coupon.
- If you chose to create a new, unique Shopify coupon code, a Create unique Shopify coupon modal will appear asking you to:
- Name your coupon (e.g. 10OFF), and add an optional Prefix.
- Select the type of discount that you would like to offer your customers (fixed amount, percentage, or free shipping).
- Choose the settings for how your coupon will operate (amount, application, activation, and expiration).
Note that if you select Never or On a specific date for Expiration, Klaviyo will generate an initial batch of 600 unique codes when the coupon is added to the form, and will generate more codes once the number available drops below 400. If you select After a certain number of days/hours, Klaviyo will generate a batch of 600 codes each day. - Click Create unique Shopify coupon in the bottom right corner. This will take you back to the form builder with the newly created coupon code selected to use in the form.
- Add an existing static coupon as a Fallback Coupon. This is a static code that will only appear if you run out of unique coupon codes, so that your customers will still receive some coupon.
You will need to create a static coupon in Shopify first to paste into the Fallback Coupon textbox (e.g. 10PERCENT).
- Skip to the final section to finish editing and publish your form.
Unique coupons for SMS
Unique coupons are also available for SMS/MMS messages.
- Generate the codes just like you would for email.
- Use the template tag below to add the coupon code to your SMS or MMS message:
{% coupon_code 'CouponName' %}.
- In the snippet, change CouponName to the name of the coupon you’re using and add it to the message (for either a flow or campaign).
Unlike with emails, you can only use 1 coupon code per SMS message. If you try to add multiple coupons to an SMS, you will see an error message.
Information on updating coupon codes
If you change the definition of your coupon, the impact on already sent codes will depend on where you made the changes to the coupon definition:
- If you change the coupon definition in Klaviyo, then it will create a new price rule and the coupons already sent to customers will not be impacted. This means that all previous coupon configurations will still apply for the already sent codes.
- For example, if a coupon code was previously set to require a minimum purchase amount of $20, Price Rule A is created in Shopify for this definition. If that coupon definition is later changed in Klaviyo to require a minimum purchase amount of $40, a brand new price rule will be created in Shopify (Price Rule B). This means that any coupons that were already sent in a flow before the change will still reflect Price Rule A ($20 minimum purchase), and thus will not be impacted by the definition change.
- If you change the coupon definition in Shopify, then coupon codes that have already been sent will be impacted.
- For example, if a coupon code was previously set to require a minimum purchase amount of $20, Price Rule A is created in Shopify for this definition. If you later make a change to Price Rule A in Shopify, so a $40 minimum purchase is now required, coupon codes that were already sent in a flow before the change will be impacted. The changes to the coupon's definition will not be reflected in Klaviyo, however, the previously sent coupon codes will be updated to the new definition ($40 minimum purchase).
If the coupon is used in a flow, 100 codes will auto-generate when you save. This allows flows to immediately send the latest version of any coupon.
Head to our article on viewing a coupon’s history to learn more.
Best practicesBest practices
If you use unique coupons in campaigns and flow messages, there are a few best practices we recommend:
- Don't use the same coupon for flows and campaigns. Because you need to specify the number of codes to be generated for campaigns, but not flows, it's best to use different coupons for each.
- Create a separate coupon for each campaign. This way, it will be easier to specify the number of codes you will need for each campaign, and you won't risk running out of codes, which would result in some recipients being skipped.
- Create a separate coupon when changing the categories or products applicable for the coupon. Klaviyo will try to assign all pre-existing codes by default, so customers may receive and use codes with outdated rules.