Abandoned Cart - Coupon Link leading to broken page.

  • 11 January 2023
  • 10 replies


I have been working on my abandoned cart flow, and for the final email, I want to give the customer a coupon code for 20% off their order. I have changed the URL on the button to:{{ event.extra.token }}?discount={% coupon_code 'ABANDONCART20' %}, but that leads to the following error:

Any idea what I am doing wrong?


Best answer by Omar 17 January 2023, 01:07

View original

10 replies

Userlevel 7
Badge +60

Hello @amanns1901,

Welcome to the Klaviyo Community!

In my experience, this sort of behavior is commonly caused by any of the following reasons:

  • Misspelled your dynamic coupon code
  • There is an integration issue preventing the coupon from being generated
  • Testing the hyperlink through a preview email instead of a live email

To alleviate this issue, I would suggest double checking to make sure the dynamic hyperlink built is correct. If you’ve done any copy and pasting, it’s recommended that you paste without formatting to ensure any additional formatting isn’t leaking over.

When Klaviyo generates coupons, we leverage the ecommerce’s own coupon API. This means that if there were any integration errors occurring, this could potentially impact the ability to generate those codes through your ecommerce store’s backend.

Lastly, because we’re working with a unique coupon code in a flow, codes would only be generated at the time of send in a live email. For this reason, if you were still in the testing phase and previewing the email through Klaviyo or sending yourself preview emails, it’s expected that the coupon/link would not work since no coupon codes has been generated and issued. Since you’re missing a part of the dynamic URL, hence why you’re being led to a broken URL page. 

You can also check out some of our past Community posts on this topic that has proved helpful to others:

I hope this helps!



is there an easy way to set up a flow that would only send emails to me so I can test it? I did one with a list sign up trigger, but that gave me an error too. Can I force a Checkout Started trigger somehow?

Userlevel 7
Badge +60

Hey @amanns1901,

If your integration is working correctly, you should be able to trigger your own Checkout Started by going through as a purchaser and abandoning the checkout process.

You can also find the steps on how to test this from the Test Started Checkout events section of our Troubleshooting Started Checkout tracking Help Center article which may be helpful to review.

My colleague, @Dov also provider steps on how to test a flow to receive a live coupon in the Community post below:


Userlevel 7
Badge +43

HI @amanns1901,

You could add a filter to that flow or set the flow to manual and catch you're checkout started in the act.

Can you share the end URL which is generated? I think that would help with finding the issue.


Hope this helps

Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

Klaviyo - CRO - Customer Value Optimization Specialist




This is the URL I end up at.

Userlevel 7
Badge +43

Hi @amanns1901,

I already see what's happening. It's not the discount code but the unique url that's not configured correctly. If I remove the whole part after and including ?discount= I still get the same error. 


So please review and make sure you're using the following variable to bring people back to their checkout

{{ event.extra.checkout_url}}


Adding the discount

{{ event.extra.checkout_url }}?discount={% coupon_code 'ABANDONCART20' %}


I hope this helps and solves your issue. If you need additional help or help with growth ;-) feel free to reach out.


Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

We help with e-commerce growth through CRO, Klaviyo and CVO




{{ event.extra.checkout_url }}?discount={% coupon_code 'ABANDONCART20' %}


Hmmm, that just seems to lead me back to my home page. When I check the cart, the discount is not applied. 

Userlevel 7
Badge +43

Can you share the output of the data that's in the {{ event.extra.checkout_url }} variable?


What is the best way I can go about doing that? 

Userlevel 7
Badge +43

The easiest way would be to:

  • go to the klaviyo homescreen
  • click on activity feed
  • click on checkout started
    • This will bring up all the checkout started events
  • click on the timestamp on the right for one of the records
  • This will bring up the activity detail and in that list there is the extra: checkout_url
  • Please copy the contents there (whole string) and paste it in a incognito browser window and see what happens. Is this bringing you to a checkout page with contents?
  • Make sure you're using a checkout URL of someone that did not place an order yet.
  • If that works - add the discount part to it and check it again.

Screenshots below