How-to · Updated December 2026

Klaviyo unique coupon codes: how to set them up and use them well

Unique codes stop a welcome discount ending up on a voucher site. Klaviyo can generate them for Shopify automatically, or use a batch you upload. Here's how both work.

Why unique codes are worth the setup

A shared code like WELCOME10 is easy, and it spreads. Within weeks it's on browser extensions and voucher sites, and you're giving a discount to customers who were going to buy anyway. Unique codes are generated per person and can only be used once, so the discount goes to the person you meant it for.

Option 1: codes generated for Shopify

With Shopify connected, Klaviyo can create codes in your store on the fly as each email sends.

  1. In Klaviyo, open the Coupons area and create a new coupon.
  2. Choose Shopify as the type so Klaviyo generates codes in your store.
  3. Give it a clear internal name, for example WELCOME_10_PCT. You'll use this name in emails.
  4. Set the discount: percentage or fixed amount, any minimum order value, and whether it applies to specific collections.
  5. Set the expiry, either a fixed date or a number of days after each code is created.
  6. Optionally set a prefix so codes are recognisable in Shopify reports, such as WEL-.

Option 2: upload your own batch

For platforms where Klaviyo doesn't generate codes, create a batch of single-use codes in your store, export them as a CSV and upload them to a static coupon in Klaviyo. Each recipient receives the next unused code from the batch. Upload more than you think you'll need, because recipients who arrive after the batch runs out simply gets no code.

Adding a code to an email or SMS

In the email editor, use the coupon block or insert the coupon tag into a text block. The tag looks like this:

{% coupon_code 'WELCOME_10_PCT' %}

Klaviyo replaces it with a fresh code for each recipient when the message sends. The same tag works in SMS. Always send yourself a preview with a real profile, since the preview pane can't show a live code.

Where unique codes make most sense

  • Welcome series. The classic use. The code promised on your signup form arrives in the first email.
  • Abandoned checkout, final message only. Reserve it for first-time buyers so loyal customers don't learn to abandon carts. We set this up in our guide to the best Klaviyo flows.
  • Winback. A time-limited code for customers who've lapsed.
  • Post-purchase cross-sell. A modest incentive towards the second order, as in our post-purchase flow build.
  • Birthday flows. A personal code feels more like a gift than a public one.

Keeping discounts under control

  • Use expiry dates, shorter ones create urgency and limit leakage.
  • Exclude existing customers from first-order offers with flow filters.
  • Watch Shopify's discount reports for codes being used far more often than expected, which usually means a shared code has escaped somewhere.
  • Test whether you need a discount at all. Free delivery or a gift with purchase often converts as well at a lower cost.

Shopify's help centre has a clear guide to how discounts work on the store side, which is useful when you're deciding what rules to set.

Common problems

The code shows as blank

Usually an uploaded batch has run out, or the coupon name in the tag doesn't exactly match the coupon in Klaviyo. Names are case-sensitive.

The code says invalid at checkout

Check the discount rules in Shopify: minimum order value, eligible collections and expiry. Customers often try codes on sale items that are excluded.

Questions people ask

How do I create a unique coupon code in Klaviyo?

Go to the Coupons area in Klaviyo, create a new coupon, choose Shopify (or your platform) to have Klaviyo generate unique codes automatically, set the discount and expiry, then add the coupon to an email or SMS with the coupon block or tag.

Can Klaviyo generate coupon codes for WooCommerce?

Klaviyo generates codes automatically for some platforms, including Shopify. For others you can generate a batch of codes in your store and upload them to Klaviyo as a static list, which it hands out one per recipient.

Do Klaviyo unique codes expire?

You can set an expiry when creating the coupon, either a fixed date or a number of days after the code is generated for each person.

What happens if I run out of uploaded codes?

Recipients won't get a code once an uploaded batch is used up. Keep an eye on the remaining count and upload more before a large send.

Keep reading

Bring us the ambition. We’ll build the system behind it.