Any way to "click and copy" discount code from an email?

Userlevel 2
Badge +3
  • Problem Solver II
  • 17 replies

Hi all,

A client wants to allow customers to “click and copy” the Klaviyo discount code to their clipboard and be taken to the cart to “paste” that code into the coupon field.  I guess they’re trying to make it easier for a customer to use the coupon code, but I’m not sure how this can be done in Klaviyo email.


Best answer by Dov 14 May 2021, 17:30

View original

11 replies

Userlevel 2
Badge +3

Also, these are dynamically generated discount codes from Shopify, displayed in Klaviyo email. The CTA is below the item.product.title block and is a Button Block. I'm not sure if text or button blocks can have such custom code added to them to do this.  Any ideas?  I honestly don’t see the point in doing this, but I’m curious to know if it’s possible. 

Userlevel 7
Badge +61

Hi @MikeH,

Thank you for sharing your question with the Klaviyo Community.

Their best bet is to add a parameter to their link or button that will automatically apply the coupon code to their cart. Makes it even easier to get that coupon applied :) 

The step-by-step instructions are described here.

Thanks and have a great weekend.

Userlevel 2
Badge +3

Hi Dov,

I’m testing this but the discount code is not applied at checkout. I’ve replaced your_code with the code that exists on the backend of WP as well as the link is updated of course. Button takes me back to the home page, but no code gets applied on checkout.

I’m testing this on a win-back flow email so there’s no product block, just a banner and below that a button for CTA.

Userlevel 7
Badge +60

Thanks for those details @dov.derin!

Adding to those thoughts, @MikeH, just to confirm, are you using a static or a dynamic unique coupon code generated through Klaviyo? Per the article that Dov provided, if this was a dynamic coupon code generated from Klaviyo, you’ll want to use the following URL structure:{% coupon_code ‘your_code’ %}.

This is because the URL structure you are using of is meant to be used with static coupon codes as opposed to dynamic coupon codes. Using the suggested URL structure of{% coupon_code ‘your_code’ %} should navigate you to your homepage with the dynamic discount code applied once you visit the checkout page. 

Similarly, if you wanted the discount to be applied, but want to redirect users who click on this link to be brought to a different page on the website, you can use the{% coupon_code 'your_code' %}?redirect=/new-path URL structure. 

Also can you confirm if you were testing these URLs within Live email sends? Testing these URLs within a preview email will not allow these dynamic URLs to function correctly and will not properly reference the desired discount codes. 


Userlevel 2
Badge +3

Hi David and Dov.

Yes, most of these are dynamic coupons we created in Klaviyo under Shopify Coupons.  I used this and it works{% coupon_code ‘your_code’ %}.

Thank you!


One question though, if we wanted to instead use a text block for this purpose (I’ve used the above with an image block and it works), do we need to create a dynamic block out of the text block before the code will work?  I’ve noticed that it doesn’t work unless the text is in a dynamic block (ie: placing the text and above code as a link in the “Table Block” for an abandoned cart flow.

Userlevel 7
Badge +60

Hey @MikeH,

Glad you got it working!

To answer your question, you would not need to use a dynamic table block to utilize the above code structure as the code would still function within a normal text block. 

You can use the above link structure by simply formatting and pasting the{% coupon_code ‘your_code’ %} directly into the text block or alternatively even using that URL as a hyperlink. 

In the event your dynamic URL link is only functioning within a dynamic table block, can you confirm if you are using any other specific syntaxes or tags that may be referencing the Checkout Started event that triggers your abandoned cart flow? Also, if you were looking to provide a URL with with a discount already applied within your Abandoned Cart flow you can use the following URL structure:{{ event.extra.token }}?discount={% coupon_code 'NAME_OF_YOUR_COUPON' %}.

After this URL is formatted for your store, users who receive it within their abandoned cart email will actually be brought directly back to their checkout page with the coupon code automatically applied. You can find a guide on how to structure this URL and learn more about its usage from the How to Add a Link that Applies a Unique Coupon Code at Checkout article. 


Badge +1

Hi there!

Very interesting conversation and indeed I will apply this URL parameters for the upcoming campaigns :)

On another note, I’m still interested in the “copy to clipboard” button.

A bit of context, we have a dynamic coupon (as a property tag) already added to Klaviyo, and this is essentially a Referral code, so i don’t want the user to be able to apply to the basket, but rather to click, copy and then share as they please.

Is there a way to do the aforementioned without messing too much?



Userlevel 7
Badge +60

Hello @MarcosGM,

Great question!

At this time Klaviyo does not support a “copy to clipboard” function. Since this referral code is already set as a profile property, you can reference it and have it dynamically appear for users to manually click and copy the code by utilizing dynamic variables. The variable you’ll want to use is the following {{ person|lookup:’PROFILE_PROPERTY’ }} while replacing the “PROFILE_PROPERTY” section. 

You can learn more about using custom profile properties and dynamic variables from the About Custom Properties and Template Tags and Variable Syntax articles. I’ll also be sharing this product feedback with your Product Team to consider!

Thanks for being a member of the Klaviyo Community!


Badge +1

Hi David!

Yes, that’s exactly what I ended up doing, simply adding a text block with some formatting to make it more visible.

It would be great to add that feature (to the many others) within the button block :)



Badge +2


Worked it out (Create a new coupon code in Klaviyo) - New user error! 


And what about woocommerce users? Is it just not possible?