Search Docs…

Search Docs…

How to add link that applies a coupon code to a Shopify cart

How to add link that applies a coupon code to a Shopify cart

You will learn

Learn how to add a link in your email that applies a coupon code directly to a shopper's Shopify cart. Having the coupon already applied to the cart makes it easier for them to take advantage of the discount and buy quickly. To set this up:

  1. Create a coupon code. This can be inserted as a parameter into a link.

  2. Add the link to a button in your email.

When the subscriber clicks the button in your email it will redirect them to the link and automatically apply the discount to their next cart.

Before you begin

 Knowledge CheckYou will need to have your Shopify site integrated with Klaviyo to set this up. Head to our guide on how to integrate with Shopify for step-by-step instructions on integrating, if you have not already done so.

Create a coupon code

  1. Navigate to Content > Coupons to create your coupon code. You can create either a static code or unique codes.

    • To create a static code, head to Shopify and create a percentage discount code or a monetary discount code according to the type of promotion you want to offer.

      Discounts page in Shopify for SPRINGSALE store showing Discount Code, Discount Type and Value, and Summary.
    • To create unique (also called "dynamic") codes, follow the instructions outlined in how to create unique coupon codes for Shopify.

      Note that unique coupons must be either imported or created in Klaviyo, while static coupons must be created in Shopify. 

  2. Once you've created the code, copy it so that you can later paste it in your email template.

  3. Choose whether you want to send the coupon within a flow or campaign email, found via the Flows or Campaigns tab in Klaviyo respectively.

  4. Open your email template in the editor. 

  5. Drag and drop a button block into your email template for your link, if there is not one already.

  6. Paste the link In the button's URL field (with the code as a parameter). For help formatting your link, read the next section.

    • Example of a button with a link:

      SHOPcart1.jpg
  7. Customize your button text to alert shoppers about your coupon.

  8. Click Save

Link formats for coupon codes

Note that Klaviyo cannot ensure that a coupon will be auto-applied at checkout if you initially link customers to a non-checkout page; your Shopify site may end up stripping the coupon from the site URL. If you link to a non-checkout page and experience this issue, you should contact your theme developer.

Apply a discount code and link to checkout 

Shopify syncs the Checkout Started event to Klaviyo with a Checkout URL property, which links back to each customer's unique cart. If you are sending Abandoned Cart emails (triggered by the Checkout Started event) and would like to link a customer to their abandoned cart with a discount code added, add the following snippet:

Static Shopify coupon link structure:

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

Klaviyo-generated coupon link structure:

{{ event.extra.checkout_url }}&discount={% coupon_code 'CouponName' %}

Apply a discount code and link to your homepage

You can add a link that points back to your homepage and automatically applies the discount to your customer's cart. There are multiple formats you can use:

  1. mysite.com/discount/CouponName

  2. mysite.com/?discount=CouponName
    This link format works when your discount is the only parameter you're adding to your link. 

  3. mysite.com/discount/{% coupon_code 'CouponName' %}

With any of these options, you should replace mysite.com with your website, and where you see CouponName, make sure to replace with the discount code you created in Shopify.

Apply a discount code and link to another page on your site

You may want to apply a discount code to a shopping session, such as a collection page or another page on your site, rather than link the customer directly back to your homepage or rebuild the customer's abandoned cart.

In this case, you can use one of the following URL structures:

  1. mysite.com/discount/CouponName?redirect=/new-path

  2. mysite.com/discount/{% coupon_code 'CouponName' %}?redirect=/new-path

With either structure, replace:

  • mysite.com with your website

  • CouponName with the name of your coupon

  • new-path with the desired URL extension. For example, if you would like to link someone to a specific collection page, you would use ?redirect=/collections/mycollection

Troubleshooting

Here are some quick troubleshooting tips: 

  1. When previewing the message, note that it won't show a live coupon. Instead, you’ll see the name of your coupon, followed by -PREVIEW.

  2. If you trigger a live send and your coupon code isn't auto-applying to your cart, ask yourself the following questions:

    • Is the item in the cart is already discounted? If it is, Shopify won't allow an additional discount on top of the existing discount.

    • In the coupon definition, are there specific products or collections that the coupon applies to, and does the product in the cart match the configuration? If the product doesn't match the coupon rules, this could be the issue.

  3. If you test your link in a live send and it does not properly apply your discount code, you likely need to adjust the added parameter so that it starts with "&" instead of "?".

    • This is because "?" only works when your discount is the only parameter you're adding to your link, and if you're adding multiple parameters, you'll need to use "&".  Change your link format to the following and it should work:

mysite.com/discount/{% coupon_code 'your_code' %}&redirect=/new-path

You will learn

Learn how to add a link in your email that applies a coupon code directly to a shopper's Shopify cart. Having the coupon already applied to the cart makes it easier for them to take advantage of the discount and buy quickly. To set this up:

  1. Create a coupon code. This can be inserted as a parameter into a link.

  2. Add the link to a button in your email.

When the subscriber clicks the button in your email it will redirect them to the link and automatically apply the discount to their next cart.

Before you begin

 Knowledge CheckYou will need to have your Shopify site integrated with Klaviyo to set this up. Head to our guide on how to integrate with Shopify for step-by-step instructions on integrating, if you have not already done so.

Create a coupon code

  1. Navigate to Content > Coupons to create your coupon code. You can create either a static code or unique codes.

    • To create a static code, head to Shopify and create a percentage discount code or a monetary discount code according to the type of promotion you want to offer.

      Discounts page in Shopify for SPRINGSALE store showing Discount Code, Discount Type and Value, and Summary.
    • To create unique (also called "dynamic") codes, follow the instructions outlined in how to create unique coupon codes for Shopify.

      Note that unique coupons must be either imported or created in Klaviyo, while static coupons must be created in Shopify. 

  2. Once you've created the code, copy it so that you can later paste it in your email template.

  3. Choose whether you want to send the coupon within a flow or campaign email, found via the Flows or Campaigns tab in Klaviyo respectively.

  4. Open your email template in the editor. 

  5. Drag and drop a button block into your email template for your link, if there is not one already.

  6. Paste the link In the button's URL field (with the code as a parameter). For help formatting your link, read the next section.

    • Example of a button with a link:

      SHOPcart1.jpg
  7. Customize your button text to alert shoppers about your coupon.

  8. Click Save

Link formats for coupon codes

Note that Klaviyo cannot ensure that a coupon will be auto-applied at checkout if you initially link customers to a non-checkout page; your Shopify site may end up stripping the coupon from the site URL. If you link to a non-checkout page and experience this issue, you should contact your theme developer.

Apply a discount code and link to checkout 

Shopify syncs the Checkout Started event to Klaviyo with a Checkout URL property, which links back to each customer's unique cart. If you are sending Abandoned Cart emails (triggered by the Checkout Started event) and would like to link a customer to their abandoned cart with a discount code added, add the following snippet:

Static Shopify coupon link structure:

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

Klaviyo-generated coupon link structure:

{{ event.extra.checkout_url }}&discount={% coupon_code 'CouponName' %}

Apply a discount code and link to your homepage

You can add a link that points back to your homepage and automatically applies the discount to your customer's cart. There are multiple formats you can use:

  1. mysite.com/discount/CouponName

  2. mysite.com/?discount=CouponName
    This link format works when your discount is the only parameter you're adding to your link. 

  3. mysite.com/discount/{% coupon_code 'CouponName' %}

With any of these options, you should replace mysite.com with your website, and where you see CouponName, make sure to replace with the discount code you created in Shopify.

Apply a discount code and link to another page on your site

You may want to apply a discount code to a shopping session, such as a collection page or another page on your site, rather than link the customer directly back to your homepage or rebuild the customer's abandoned cart.

In this case, you can use one of the following URL structures:

  1. mysite.com/discount/CouponName?redirect=/new-path

  2. mysite.com/discount/{% coupon_code 'CouponName' %}?redirect=/new-path

With either structure, replace:

  • mysite.com with your website

  • CouponName with the name of your coupon

  • new-path with the desired URL extension. For example, if you would like to link someone to a specific collection page, you would use ?redirect=/collections/mycollection

Troubleshooting

Here are some quick troubleshooting tips: 

  1. When previewing the message, note that it won't show a live coupon. Instead, you’ll see the name of your coupon, followed by -PREVIEW.

  2. If you trigger a live send and your coupon code isn't auto-applying to your cart, ask yourself the following questions:

    • Is the item in the cart is already discounted? If it is, Shopify won't allow an additional discount on top of the existing discount.

    • In the coupon definition, are there specific products or collections that the coupon applies to, and does the product in the cart match the configuration? If the product doesn't match the coupon rules, this could be the issue.

  3. If you test your link in a live send and it does not properly apply your discount code, you likely need to adjust the added parameter so that it starts with "&" instead of "?".

    • This is because "?" only works when your discount is the only parameter you're adding to your link, and if you're adding multiple parameters, you'll need to use "&".  Change your link format to the following and it should work:

mysite.com/discount/{% coupon_code 'your_code' %}&redirect=/new-path

You will learn

Learn how to add a link in your email that applies a coupon code directly to a shopper's Shopify cart. Having the coupon already applied to the cart makes it easier for them to take advantage of the discount and buy quickly. To set this up:

  1. Create a coupon code. This can be inserted as a parameter into a link.

  2. Add the link to a button in your email.

When the subscriber clicks the button in your email it will redirect them to the link and automatically apply the discount to their next cart.

Before you begin

 Knowledge CheckYou will need to have your Shopify site integrated with Klaviyo to set this up. Head to our guide on how to integrate with Shopify for step-by-step instructions on integrating, if you have not already done so.

Create a coupon code

  1. Navigate to Content > Coupons to create your coupon code. You can create either a static code or unique codes.

    • To create a static code, head to Shopify and create a percentage discount code or a monetary discount code according to the type of promotion you want to offer.

      Discounts page in Shopify for SPRINGSALE store showing Discount Code, Discount Type and Value, and Summary.
    • To create unique (also called "dynamic") codes, follow the instructions outlined in how to create unique coupon codes for Shopify.

      Note that unique coupons must be either imported or created in Klaviyo, while static coupons must be created in Shopify. 

  2. Once you've created the code, copy it so that you can later paste it in your email template.

  3. Choose whether you want to send the coupon within a flow or campaign email, found via the Flows or Campaigns tab in Klaviyo respectively.

  4. Open your email template in the editor. 

  5. Drag and drop a button block into your email template for your link, if there is not one already.

  6. Paste the link In the button's URL field (with the code as a parameter). For help formatting your link, read the next section.

    • Example of a button with a link:

      SHOPcart1.jpg
  7. Customize your button text to alert shoppers about your coupon.

  8. Click Save

Link formats for coupon codes

Note that Klaviyo cannot ensure that a coupon will be auto-applied at checkout if you initially link customers to a non-checkout page; your Shopify site may end up stripping the coupon from the site URL. If you link to a non-checkout page and experience this issue, you should contact your theme developer.

Apply a discount code and link to checkout 

Shopify syncs the Checkout Started event to Klaviyo with a Checkout URL property, which links back to each customer's unique cart. If you are sending Abandoned Cart emails (triggered by the Checkout Started event) and would like to link a customer to their abandoned cart with a discount code added, add the following snippet:

Static Shopify coupon link structure:

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

Klaviyo-generated coupon link structure:

{{ event.extra.checkout_url }}&discount={% coupon_code 'CouponName' %}

Apply a discount code and link to your homepage

You can add a link that points back to your homepage and automatically applies the discount to your customer's cart. There are multiple formats you can use:

  1. mysite.com/discount/CouponName

  2. mysite.com/?discount=CouponName
    This link format works when your discount is the only parameter you're adding to your link. 

  3. mysite.com/discount/{% coupon_code 'CouponName' %}

With any of these options, you should replace mysite.com with your website, and where you see CouponName, make sure to replace with the discount code you created in Shopify.

Apply a discount code and link to another page on your site

You may want to apply a discount code to a shopping session, such as a collection page or another page on your site, rather than link the customer directly back to your homepage or rebuild the customer's abandoned cart.

In this case, you can use one of the following URL structures:

  1. mysite.com/discount/CouponName?redirect=/new-path

  2. mysite.com/discount/{% coupon_code 'CouponName' %}?redirect=/new-path

With either structure, replace:

  • mysite.com with your website

  • CouponName with the name of your coupon

  • new-path with the desired URL extension. For example, if you would like to link someone to a specific collection page, you would use ?redirect=/collections/mycollection

Troubleshooting

Here are some quick troubleshooting tips: 

  1. When previewing the message, note that it won't show a live coupon. Instead, you’ll see the name of your coupon, followed by -PREVIEW.

  2. If you trigger a live send and your coupon code isn't auto-applying to your cart, ask yourself the following questions:

    • Is the item in the cart is already discounted? If it is, Shopify won't allow an additional discount on top of the existing discount.

    • In the coupon definition, are there specific products or collections that the coupon applies to, and does the product in the cart match the configuration? If the product doesn't match the coupon rules, this could be the issue.

  3. If you test your link in a live send and it does not properly apply your discount code, you likely need to adjust the added parameter so that it starts with "&" instead of "?".

    • This is because "?" only works when your discount is the only parameter you're adding to your link, and if you're adding multiple parameters, you'll need to use "&".  Change your link format to the following and it should work:

mysite.com/discount/{% coupon_code 'your_code' %}&redirect=/new-path

e2 Agency

© 2023