Solved

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

  • 13 May 2021
  • 9 replies
  • 376 views

Userlevel 2
Badge

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.

icon

Best answer by Dov 14 May 2021, 17:30

View original

9 replies

Userlevel 2
Badge

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 6
Badge +5

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

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 mysite.com link is updated of course. Button takes me back to the home page, but no code gets applied on checkout.

mysite.com/?discount=your_code

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 6
Badge +4

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: mysite.com/discount/{% coupon_code ‘your_code’ %}.

This is because the URL structure you are using of mysite.com/?discount=your_code is meant to be used with static coupon codes as opposed to dynamic coupon codes. Using the suggested URL structure of mysite.com/discount/{% 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 mysite.com/discount/{% 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. 

-David

Userlevel 2
Badge

Hi David and Dov.

Yes, most of these are dynamic coupons we created in Klaviyo under Shopify Coupons.  I used this and it works mysite.com/discount/{% 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 6
Badge +4

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 mysite.com/discount/{% 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: https://www.mysite.com/STOREFRONT_ID/checkouts/{{ 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. 

-David

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?

Thanks,

Marcos.

Userlevel 6
Badge +4

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!

David

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

Thanks!

Marcos.

Reply