Sticky Tutorial

How to Add Dynamic and Static Coupons to Emails

  • 21 September 2020
  • 4 replies

Userlevel 4

Depending on the type of message you're sending, there are two different ways to add a link to an email in order to automatically include a coupon to the recipients cart. For a dynamic coupon, such as in an abandoned cart flow, the structure of your link will look like this:{{ event.extra.token }}?discount={% coupon_code 'NAME_OF_YOUR_COUPON' %}


If you're using a static coupon, then instead of appearing like

{% coupon_code 'NAME_OF_YOUR_COUPON' %}


it will just be:



Head to this article on Add a Link that Automatically Applies a Unique Coupon Code at Checkout for more information.

For any other flow or campaign message, you will need to point to your website, add the coupon and redirect all within the same link. That would look like this:{% coupon_code 'your_code' %}?redirect=/new-path


Again, if you're not using a dynamic code, you can replace that tag with just your static coupon's name.{% coupon_code 'your_code' %}?redirect=/new-path



4 replies

Userlevel 7
Badge +5

Great summary on dynamic coupons for Shopify!  A few things to add that might be helpful:

  • You can use the link for images, buttons, inline links (within a text block).  Pretty much anywhere that you can add a URL.
  • For campaign/flow (not cart abandonment) emails, you can couple this with the Shopify “Add an item/variant to Cart” permalink in the redirect to apply the coupon, and add something to their cart in one go.  See this for more info:
  • And like all Klaviyo Dynamic Coupon Codes, you can use the same specified coupon for subsequent emails and it will “resuse” the same previously generated code (as long as the code has not expired).
Userlevel 6
Badge +5

@retention Thanks Joseph for the additional tips here, and adding more color to dynamic coupon codes!

Big fan of the dynamic coupon feature! 

A potentially niche but related questions: could I use this feature to generate unique codes that are not associated with a discount? We would like to set it up an auto response email that customers receive when they sign up for our lifetime warranty so that each customer gets a unique warranty code that is required down the line should they ever need to make a warranty claim. Obviously we don’t want there to be a discount linked to this random collection of letters/numbers. Is there another way to have a unique code generated in emails? 

Thanks in advance!


Userlevel 6
Badge +5

Hi @katharling 

This is a great question, and I love that you offer lifetime warranty on your products. Unfortunately, the built-in Shopify coupon feature would not be the best fit for generating unique codes for warranty, but you could upload unique coupon codes to Klaviyo and reference them in your campaign or flow emails. This isn’t an automatically enabled feature, so if you want to send me a direct message (DM), I can work with you to get this switched on. 

You can read more about Uploading Unique Coupon Codes here. A key thing to note is that you’ll need to generate the list of warranty codes ahead of time, upload them via the enabled feature mentioned above, and manage the number of available codes on your own or through your point of sale software. 

Hope this was helpful and thanks again for being a part of our community!