Klaviyo Discount Codes: How to Set Them Up for Email Campaigns

A woman with curly hair holding shopping bags
A profile picture of Steve Pogson, founder and strategist at First Pier Portland, Maine
Steve Pogson
Published
January 2, 2024
Last Updated
August 11, 2026

Introduction

Klaviyo discount codes are one of the most direct levers you have between an email and a checkout. Used well, they lift conversion on welcome and abandoned-cart flows, give lapsed customers a reason to come back, and produce clean data on which offers actually move revenue. Used carelessly, they leak margin and get shared across the internet within a day.

This guide covers how to set up discount codes in Klaviyo, how to connect them to a Shopify store so the discount applies at the cart, how to generate unique one-time codes per recipient, and how to measure whether the offer paid for itself.

What a Klaviyo discount code is

A Klaviyo coupon is a record inside Klaviyo that maps to a discount in your ecommerce platform. Klaviyo does not process the discount itself — Shopify does. What Klaviyo controls is which subscriber receives which code, when, and inside which email or SMS message. That separation matters, because most setup problems come from a mismatch between what was configured in Shopify and what Klaviyo is trying to insert into the message.

Learning about Klaviyo - klaviyo discount code infographic pillar-5-steps

The discount types available to you

Klaviyo supports three discount structures, and each one suits a different objective:

  • Fixed amount: a set dollar value off the order, such as $20 off. Straightforward for customers to evaluate, and it protects you on low-priced items where a percentage would give away very little.
  • Percentage: a proportional discount on the order total. Better for stores with a wide price range, and better for driving larger baskets.
  • Free shipping: removes the shipping cost. Requires a maximum shipping rate and country eligibility so a customer in a high-cost shipping zone cannot use it against an expensive freight quote.

Shopify also supports Buy X Get Y discounts. Those are built on the Shopify side and delivered through Klaviyo as a static code rather than a Klaviyo-generated coupon.

Two ways Klaviyo handles coupon codes

This is the distinction most setups get wrong, so it is worth being precise about it before you build anything:

  1. Shopify coupons are created inside Klaviyo once, and Klaviyo generates a unique code for each individual recipient at send time. You define a prefix, the discount, and the rules; every subscriber gets their own single-use code. This requires an active Shopify integration.
  2. Uploaded coupons are codes you generate elsewhere — usually in bulk in the Shopify admin — and then upload to Klaviyo as a list. Klaviyo assigns one code per recipient from that list. Use this when the discount type or conditions are more complex than Klaviyo's coupon builder supports, or when the codes need to exist in Shopify ahead of time.

A third option is a plain static code: one code, typed directly into the email, shared by everyone who receives it. It is fine for a public seasonal promotion and a poor choice for anything you want to keep contained.

How to Generate a Discount Code in Klaviyo

Creating a code takes a few minutes. Deciding what the code should do, and what guardrails it needs, takes longer and matters more.

Before you start: connect Klaviyo to Shopify

Klaviyo's Shopify coupon feature only appears once the two platforms are connected. If the integration is not live yet:

  1. Go to the Shopify App Store and search for Klaviyo.
  2. Add the app to your store.
  3. Log into your existing Klaviyo account, or create one.
  4. Authorize the connection and allow the initial data sync to finish.

The sync pulls in your customers, orders, products and checkout events. Those are what make segmentation and coupon targeting useful later. If you are still deciding how the two platforms should fit together, our guide to Klaviyo and Shopify covers the wider integration.

Creating a Shopify coupon in Klaviyo

To create a coupon that generates a unique code per recipient:

  1. Open the Coupons section of your Klaviyo account.
  2. Choose Create Shopify Coupon.
  3. Name the coupon. Use a single word with no spaces — the name becomes the reference you insert into the email, and spaces cause errors.
  4. Set a prefix. This is the readable part of every generated code, such as WELCOME or VIP, and it makes reporting far easier when several campaigns are running at once.
  5. Select the discount type and value: percentage, fixed amount, or free shipping.
  6. Set the conditions — minimum purchase amount, and whether the discount applies to the whole order or only to specific products or collections.
  7. Set usage limits. One use per code and one use per customer are the sensible defaults for anything sent to an individual.
  8. Set the expiration. You can give the code a fixed end date, make it expire a set number of days after it is sent, or let it run indefinitely.
  9. Save the coupon.

Expiration relative to send date is the more useful option inside automated flows. A code that expires seven days after a subscriber receives it creates the same urgency for someone who joins in March as for someone who joins in November, without you having to rebuild the flow each season.

Creating an uploaded coupon

If you need codes that already exist in Shopify, generate them there first and bring them into Klaviyo:

  1. In the Shopify admin, go to Discounts and create the discount, setting the type, conditions, usage limits and active dates.
  2. Generate the batch of unique codes you need. Size the batch against the audience you plan to send to, plus a margin — Klaviyo will not be able to insert a code once the list runs dry.
  3. Export the codes to a CSV file.
  4. In Klaviyo, open Coupons, choose Create Uploaded Coupon, name it, set an expiration date, and upload the file.

Our walkthrough on creating discount codes on Shopify covers the Shopify-side configuration in more detail, including the discount combination rules.

Naming and organizing your coupons

Coupon libraries get messy quickly. A few habits that hold up over time:

  • Use one word, no spaces, in the Klaviyo coupon name.
  • Encode the purpose in the name — the flow or campaign it belongs to and the discount value, for example Welcome10 or Winback15.
  • Keep the prefix human-readable. Customers do read the code, and a code that names the offer feels intentional rather than automated.
  • Retire codes you are no longer using rather than leaving them active with no end date.

Editing and managing existing coupons

Offers change mid-campaign more often than anyone plans for. To adjust a coupon already in use, open the Coupons section, select the coupon, edit the details such as the name or expiration date, and save. Be careful editing a coupon that is live in a sending flow — codes already delivered to inboxes keep the terms they were issued under, so a mid-flight change can leave two sets of rules in circulation at the same time.

Testing your Klaviyo coupon code

Test every coupon before it goes anywhere near a live audience. In the email editor, preview the message. Where the code should appear, you will see the coupon name followed by -PREVIEW. That suffix is the confirmation you are looking for: it means the dynamic coupon variable resolved correctly and Klaviyo will substitute a real code at send time. If you see the raw variable text instead, the reference is wrong.

Then send a test to yourself and run the code through an actual checkout. Preview confirms Klaviyo can find the coupon; only a real transaction confirms Shopify will honor it under the conditions you set. If the code fails at checkout, the cause is almost always on the Shopify side — a minimum purchase threshold, a product exclusion, or a discount-combination rule blocking it.

How to Add a Coupon Code to a Shopify Cart Using Klaviyo

Asking a customer to copy a code and paste it at checkout adds friction at the worst possible moment. Shopify supports discount links that apply the code automatically, and Klaviyo can build those links dynamically for each recipient.

Creating a custom URL for your coupon code

Shopify accepts a discount in the URL itself, using this pattern:

https://yourstoreurl.com/discount/COUPONCODE

Replace yourstoreurl.com with your store domain and COUPONCODE with the code. When a customer follows that link, Shopify applies the discount to their session and carries it through to checkout.

You can also control where the link lands by appending a redirect, which is useful when the offer applies to a specific range:

https://yourstoreurl.com/discount/COUPONCODE?redirect=/collections/sale

Using the dynamic coupon variable in the link

For a unique code per recipient, the code cannot be hard-coded into the URL. Insert Klaviyo's coupon variable instead, so each subscriber's own code is written into their own link:

https://yourstoreurl.com/discount/{% coupon_code 'YourCouponName' %}

The name inside the quotes must match the Klaviyo coupon name exactly, which is why the no-spaces rule matters. Klaviyo resolves the variable at send time, so every recipient receives a link carrying only their code.

Integrating the custom URL with your Shopify cart

Once the URL is built, attach it to whatever the customer is going to click:

  1. Open the email, SMS, page or post where the offer appears.
  2. Add the clickable element — a button, image or text link — and set its destination to the custom URL.
  3. Make the button copy carry the offer, not just the action. "Take 15% off" outperforms "Shop now" because the value is visible before the click.

Testing the custom URL

Send yourself a test, click the link, and confirm the discount is visible in the cart before checkout. If nothing applies, check three things in order: whether the code itself works when entered manually at checkout, whether the store domain in the URL matches your live domain, and whether the coupon name in the variable matches the Klaviyo coupon exactly. Most failures are a mismatch at one of those three points rather than anything more complicated.

Creating Unique Coupon Codes for Shopify Using Klaviyo

Unique coupon codes — also called dynamic coupon codes — are single-use codes issued to one person. They are the right default for anything sent to an individual subscriber, and they solve problems a shared static code cannot.

Why unique codes are worth the extra setup

  • Containment: a single-use code cannot be posted to a coupon aggregator and redeemed a thousand times. Static codes routinely end up on those sites within hours of a send.
  • Cleaner attribution: because the code belongs to one recipient, redemption tells you exactly who converted and from which message, rather than giving you an aggregate you have to untangle.
  • Controlled exposure: your discount liability is bounded by the number of codes issued rather than by how far a screenshot travels.
  • Personalization: a code that belongs to the recipient reads as an offer made to them, which is a different message from a code printed on the homepage.

Option 1: let Klaviyo generate the codes

This is the simpler path and works for most stores. Create a Shopify coupon in Klaviyo as described above, then insert it into your message using the coupon variable rather than typing a code. Klaviyo mints a code for each recipient at send time and pushes it to Shopify, so the discount exists the moment the customer needs it. No pre-generated list, and nothing to run out of.

Option 2: bulk-generate in Shopify and upload

Use this when the discount needs conditions Klaviyo's coupon builder does not cover, or when another system needs to know about the codes in advance:

  1. In the Shopify admin, open Discounts and select Create discount.
  2. Choose a discount code and enter a base code, which becomes the prefix for every generated code.
  3. Set the discount value — percentage, fixed amount, or free shipping — and any minimum purchase or product conditions.
  4. Set usage limits, including one use per customer, and an end date.
  5. Generate the number of unique codes you need.
  6. Export the codes and upload the file to Klaviyo as an uploaded coupon.

Watch the list size on this path. If more people qualify for the send than you have codes, later recipients get an email with a gap where the code should be.

Testing and verifying your unique coupon codes

Pull one generated code and run a real test purchase with it. Confirm the discount applies, then confirm it is refused on a second attempt — that second check is the one that proves single-use enforcement is actually working, and it is the one most teams skip.

Adding Coupon Codes to Sign-Up Forms in Klaviyo

The sign-up form is where most stores acquire the email addresses everything else depends on. A discount offered at that moment is the highest-leverage use of a coupon you have, because it buys a subscriber and often a first order at the same time.

What a sign-up offer does for you

  1. Higher form conversion: a concrete incentive converts better than a request to join a list.
  2. Faster first purchase: a new subscriber holding a code that expires has a reason to buy now rather than later.
  3. Better data from the start: the redemption tells you which acquisition source produces buyers rather than just addresses.

How to add a coupon offer to your Klaviyo sign-up form

  1. Go to the Sign-Up Forms section under the Forms tab in Klaviyo.
  2. Select the form you want to change and click Edit.
  3. In the content editor, state the offer clearly on the first step of the form, and confirm it on the success step so the subscriber knows the code is on its way.
  4. Save the changes before exiting.

Deliver the code by email rather than displaying it on the success screen when you can. Displaying it gives away the discount to anyone who submits any address; emailing it confirms the address is real before the discount is issued.

Setting up the flow that delivers the code

The form captures the subscriber; a flow delivers the offer. In Klaviyo, go to the Flows tab, select Create Flow, and start from the welcome series template so the flow triggers on the list the form feeds. In the first email, insert the coupon variable so each new subscriber receives their own code, and keep the delivery immediate — the intent that made someone submit the form decays within minutes.

A short second message a few days later, reminding anyone who has not redeemed that the code is about to expire, typically recovers a meaningful share of the list. Our guide to the Klaviyo welcome series flow covers the wider sequence.

Using Klaviyo to Offer Tiered Discounts Through Sign-Up Forms

A flat discount treats a $30 order and a $300 order identically. Tiered discounts scale the incentive with the basket, which protects margin on small orders and rewards the larger ones you actually want.

Understanding tiered discounts

A tiered structure sets increasing incentives at increasing thresholds — 10% off at $50, 15% off at $100, and so on. The thresholds should sit just above your current average order value rather than well beyond it; a tier nobody can realistically reach is a tier nobody tries for. Check your AOV distribution before setting the numbers.

How to set up tiered discounts

  1. Create a coupon for each tier. In the Coupons section, build a separate coupon per tier, setting the minimum purchase amount that defines the threshold. Give each one an expiration and a usage limit so the offer stays contained.
  2. State the tiers on the sign-up form. Under Sign-Up Forms, edit the form and lay the tiers out plainly. Customers need to see the thresholds to aim at them.
  3. Deliver through a flow. Build the welcome flow so the subscriber receives their codes with the tiers clearly labeled, and make the qualifying amount for each tier explicit in the email rather than hidden in fine print.

Watch the discount combination rules in Shopify while you do this. If tiered codes can stack with an existing automatic discount, the effective rate can land well below what you modeled.

Promoting the form

A tiered offer only works if enough people see it. Point your existing traffic at the form — site banners, the footer, post-purchase pages, social profiles and paid landing pages — and give the form enough exposure to produce a sample worth reading before you judge whether the structure works.

Targeting the Right Segments With Coupon Codes

The same code sent to everyone subsidizes customers who would have bought anyway. Klaviyo's segmentation is what stops a discount program from quietly eroding full-price revenue.

Segments worth building before your next coupon send:

  • Lapsed buyers: customers who have purchased before but not in the last 30, 60 or 90 days, depending on your repurchase cycle. This is where a discount does the most work, because the alternative is no order at all.
  • Engaged non-buyers: subscribers who open and click but have never placed an order. A first-order incentive here converts interest that has already been demonstrated.
  • Cart and browse abandoners: the highest-intent group on the list. Many of these customers convert without a discount, so test whether the code is needed at all before applying it by default.
  • High-value repeat customers: worth an offer that reads as recognition rather than a price cut — early access or a gift with purchase often outperforms a percentage off in this group.

To build a segment, open Lists & Segments in Klaviyo, select Create List/Segment, and define the conditions using the profile and order data the Shopify integration syncs. Exclude your recent purchasers from broad discount campaigns — a code that lands two days after someone paid full price generates refund requests rather than orders.

Tracking Whether Your Coupon Codes Are Working

Discounts are the easiest tactic to run and one of the easiest to misread, because the revenue they generate is visible while the margin they consume is not.

The numbers to watch

  • Redemption rate: the share of issued codes that were used. Shopify's Discounts page shows the usage count for each discount, which is your source of truth for redemptions.
  • Attributed revenue: Klaviyo's campaign and flow reporting shows placed orders and revenue attributed to each message, so you can see which send produced the orders.
  • Average order value with and against the code: compare discounted orders to your baseline. A code that lifts conversion while dropping AOV may be net negative.
  • Discount cost against gross margin: the number that decides whether the campaign was worth running. Revenue alone will always look positive.
  • Repeat rate of coupon-acquired customers: the longer-term question. Customers acquired on a discount sometimes only ever buy on a discount, and that pattern shows up months later.

Using Klaviyo's reporting

Klaviyo's campaign and flow reports give you open, click, conversion and revenue figures per message, and its metric reports let you look at the underlying events over time. Pair those with Shopify's discount usage data to close the loop: Klaviyo tells you who received and clicked, Shopify tells you which codes were spent. Reviewing both after every promotion is what turns a series of one-off discounts into a policy you can defend. For more on building those views, see our guide to custom Klaviyo reports.

Frequently Asked Questions About Klaviyo Discount Codes

How do I add a 10% off code on Shopify using Klaviyo?

Create a Shopify coupon in Klaviyo's Coupons section, set the discount type to percentage and the value to 10, set your conditions and expiration, and save. Then insert the coupon into your email using the coupon variable rather than typing a code. Each recipient receives their own 10% code, and you can attach it to a discount link so it applies at the cart.

How do I create a unique coupon code in Klaviyo?

Either let Klaviyo generate one per recipient — create a Shopify coupon and reference it with the coupon variable — or bulk-generate unique codes in the Shopify admin, export them, and upload the file to Klaviyo as an uploaded coupon. The first is simpler and cannot run out; the second gives you codes that exist in Shopify before the send.

Can a Klaviyo coupon apply automatically at checkout?

Yes, through a Shopify discount link. Build the URL as https://yourstoreurl.com/discount/ followed by the code or the coupon variable, and Shopify applies the discount when the customer follows the link. This removes the copy-and-paste step at checkout.

Why does my coupon show "-PREVIEW" in the email preview?

That is expected. Klaviyo does not mint a real code until the message is sent, so preview mode shows the coupon name with a -PREVIEW suffix as confirmation that the variable resolved correctly. Seeing it means the setup is right.

Should I create the discount in Shopify or in Klaviyo first?

If you want Klaviyo to generate unique codes per recipient, create the coupon in Klaviyo and let it handle the Shopify side. If the discount involves conditions Klaviyo's coupon builder does not support — Buy X Get Y, for instance — build it in Shopify first, generate the codes there, and upload them to Klaviyo.

What happens if my uploaded coupon list runs out?

Recipients past the end of the list receive the email without a code. Generate a comfortable margin above your expected audience size, and check the remaining count before reusing an uploaded coupon in a new send.

Conclusion

The mechanics of a Klaviyo discount code take an afternoon to learn. The decisions around them — which segment receives a code, whether it needs to be unique, how long it lives, and what it costs in margin — are what separate a discount program that compounds from one that trains customers to wait for the next sale.

A practical starting point: make unique codes your default for anything sent to an individual, attach them to discount links so they apply at the cart, put an expiration on every one of them, and review redemption against margin after each campaign rather than reading revenue alone.

For more on the platform, see our overview of what Klaviyo is and what it does, our breakdown of Klaviyo pricing and SMS costs, and our guide to Klaviyo best practices.

Get More Ecommerce Insights:

Free: 3 quick wins for your store

Let's Do This!

Drop your Shopify store URL and we'll send back 3 quick wins — free, no pitch, and usually within 2 business days.

Prefer to talk? Book a call

Get your 3 quick wins

Thanks! We'll review your store and send your 3 quick wins within 2 business days.

Oops! Something went wrong while submitting the form.

No sales call required. Usually back within 2 business days. Unsubscribe anytime.