How to create unique coupon codes for Shopify

read
Last updated at:

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

 Knowledge check

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, 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) and then navigate back to your Coupons tab. 

When to use unique coupon codes

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 the Coupons tab in Klaviyo, and click Create Shopify Coupon in the upper right-hand corner.The coupons tab in Klaviyo with Shopify Coupons tab selected and Create Shopify Coupon with blue background in upper right 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.  Coupon details page in Klaviyo including Name, Prefix, Type with Percent off selected, and Applies to
  • 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. 
    • 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.

Klaviyo coupon details page show showing Activation and Expiration settings

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.  

Generating codes after creating your coupon

Klaviyo generates coupon codes for flow emails automatically, but if you plan to use your codes in campaign emails, you must manually generate coupon codes. 

Once you create the parameters for your coupon, specify the number of coupon codes that you want to generate. This must be done before you schedule your campaign. When doing this, key things to keep in mind are:

  • 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.

You can generate coupon codes for a particular coupon by clicking the 3 dot dropdown and selecting Add Codes.

You can click the dropdown menu on the far right side to add codes, view the coupons history, or delete the coupon

Then, 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.

Add Codes modal where you can specify how many more codes to add to a coupon

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.

Once you click Add Codes, Klaviyo will begin generating coupon codes for your campaign. A progress bar will appear beneath the coupon name to display progress. You can also 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 one code per SMS). With email, you have access to hidden blocks to send different coupons based on where someone lives or what they’ve done. We recommend exercising caution with this 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. If you use multiple coupons in a message, make sure you have pre-added enough codes for every recipient to receive one of each code.

Using your coupon in a campaign email

After the codes have been generated, you can include the coupon tag in your campaign template 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).

Example of a campaign thanking customer for their loyalty with a 15 coupon

When emails are sent out, this variable will be dynamically replaced with a unique discount code for each recipient. When you preview the email directly in Klaviyo, you will not see a unique coupon code populate.

However, if you send a preview email to yourself or a member of your team, a live code will be generated. For this reason, it's important to ensure that you have sufficient codes in your account. Otherwise, you will not see a unique code and you will need to add codes before sending a preview with a live coupon code.

If multiple people are included in the preview send, they will all receive the same code. Additionally, if multiple previews are sent within the same minute, these previews will all contain 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 email

Unique coupon codes for live flow emails are generated automatically in batches of 100. When the number of coupon codes is depleted below 100, Klaviyo will generate another 100 coupon codes. This ensures that there are always enough codes available for live flow emails. Because coupon codes for flows are replenished automatically, you won't need to manually add batches of coupon codes via the Add Codes option.

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.

Once a coupon is created, insert it into a flow email using the following dynamic placeholder variable:

{% coupon_code 'NAME_OF_YOUR_COUPON' %}

Replace NAME_OF_YOUR_COUPON with the coupon name (this must exactly match the name, including capitalization).

Example of a welcome flow email with a 10 coupon and showing images of products

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). 

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.

You can manually add codes to coupons without variable expiration dates. For emails that include coupons without variable expiration dates, you may generate a live code if you send a preview email to yourself or a member of your team. If you wish to do this, it's important to ensure that you have sufficient codes in your account on an ongoing basis. Otherwise, you will not see a unique code in previews, and the flow may stop sending if you run out of generated codes.

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.

If multiple people are included in the preview send, they will all receive the same code. Additionally, if multiple previews are sent within the same minute, these previews will all contain the same code.

Unique coupons for SMS

Unique coupons are also available for SMS/MMS messages. First, generate the codes just like you would for email. Then, 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).

Example of an SMS message with a 20 percent off coupon

Unlike with emails, you can only use one coupon code per SMS message. If you try to add multiple coupons to an SMS, you will see an error message.

Best 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.

Additional resources

x
Was this article helpful?
2744 out of 3741 found this helpful