Solved

Doesn't work: Button link which leads to the checkout page with a discount code pre-applied

  • 11 August 2022
  • 1 reply
  • 50 views

Badge

Hi all,

I've been constructing a button link which leads to the checkout page with a discount code pre-applied to be used in an abandoned checkout email, in a flow. 

I have set up the button link which leads to checkout page with discount code pre-applied using the guide in Klaviyo’s resource: https://help.klaviyo.com/hc/en-us/articles/360018227032-How-to-Add-a-Link-that-Applies-a-Unique-Coupon-Code-at-Checkout

The given template link is: https://www.mysite.com/STOREFRONT_ID/checkouts/{{ event.extra.token }}?discount={% coupon_code 'NAME_OF_YOUR_COUPON' %}

I have checked the button link multiple times but when I used the preview mode, I was led to a broken page.

I contacted Support and was advised to replace the current variable with {{ event.extra.checkouturl }}&discount={% couponcode 'My coupon code' %}, and it didn’t work either. 

 

The issue hasn’t been fixed so I’ve written back to Support but thought I’d also reach out via the community to see if anyone has encountered the same issue and had a fix for it.

 

Many thanks! 

icon

Best answer by David To 11 August 2022, 18:01

View original

1 reply

Userlevel 7
Badge +54

Hello @DeeH,

Welcome to the Klaviyo Community!

Both of those link formats should actually work in bringing your users back to their checkout page with a discount automatically applied. The difference though, is that the one provided in our How to Add a Link that Applies a Unique Coupon Code at Checkout for Shopify Help Center article is meant to bring checkout abandoners directly back to their checkout session - hence the storefront ID and checkout token variables used in the URL format. 

In my experience, if this link breaks, it typically means that either the checkout session is no longer valid or you’ve added in some extra formatting without meaning to. Oftentimes a checkout session would not longer be valid if the checkout event you were previewing as was of a customer who had already completed their purchase. Since the session was technically completed, the link wouldn’t actually be functional as there wouldn’t be an available session to take the customer back to. Keep in mind that when previewing metric triggered flows with event data, you’re previewing the emails of the ten most recent events that triggered the metric - regardless of the overall outcome or future actions taken by your customers. 

Another common mistake that I come across frequently - especially when it comes to dynamic variables - is copy and pasting additional formatting. When you’re copy and pasting data from one source to another, we highly recommend copying and pasting without formatting. You can paste something without formatting by Ctrl+Shift+V instead of Ctrl+V when pasting. If you’re using a Mac, you would use the Option+Shift+Command+V commands. 

Also, don’t forget, that because you’re only previewing the email rather than sending it live, it’s expected behavior that the discount code wouldn’t work and proceeds with a PREVIEW messaging. My colleague @Dov, our champion @retention, and myself have explained in past Community posts:

I hope this helps! If you were able to find an alternative solution after working with our Support colleagues, it would be great if you shared that solution here as it may help other Community members who come across the same issue!

David

Reply