Add Link that Automatically Applies a Discount Code to Abandoned Cart



In your abandoned cart emails, you should have a link or button that takes the shopper back to his/her abandoned cart. If you're offering a discount to those who decide to head back to your website and complete a purchase, having this discount already applied when they get there makes it even easier for them to take advantage of the discount and buy quickly.

Create a Discount Code in Shopify

First, in Shopify, you will have to create a percentage discount code or a monetary discount code according to the type of promotion you want to offer.

The code you create will need to be inserted as a parameter in your "return to cart" link or button. After you create this code, make sure to have it handy as you move on to update your email template.

Update Abandoned Cart Email Template

To achieve this functionality, you will need to add a parameter to your existing "return to cart" link -- or button -- that will immediately apply your discount to the email recipient's cart when clicked.

If you are leveraging Klaviyo's default Abandoned Cart emails, your current "return to cart" link uses the following checkout URL variable:

{{ event.extra.checkout_url }}

This is the parameter you will be adding to the end:


Where you see your_code, make sure to replace with the discount code you created in Shopify. The final Link URL will look like this:

{{ event.extra.checkout_url }}?discount=your_code

You can also use a dynamic coupon code. First, follow the steps to create a dynamic coupon in your Klaviyo account. Then, replace "your_code" with the tag for your dynamic coupon code. The final URL will look something like this:

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


If you test this and see that the updated link is not properly applying your discount code, you likely need to adjust the added parameter so that it starts with "&" instead of "?". Change your parameter to the following and it should work -- if not, contact our Success Team.

{{ event.extra.checkout_url }}&discount=your_code

Was this article helpful?
6 out of 9 found this helpful