Apply an automatic discount to an abandoned checkout recovery email

You can automatically apply a discount to your abandoned checkout recovery emails, which send a pre-filled cart to your customers to let them quickly complete their abandoned checkout at a discounted price – they will only need to enter payment details.


If the customer manually entered any other discount code when beginning their checkout, that discount code will be replaced by the checkout recovery discount code using this method.

Before you begin

To get started setting up a discount for abandoned checkout recovery emails:

  1. Create a percentage discount code or a monetary discount code according to the type of promotion you want to offer.

  2. Make sure to make a note of the name you give your discount code when you create it, for example WelcomeBack. You assign a name to your discount code when you create a discount.


    Avoid using special characters in your discount names so that your discount names add correctly to your store's checkout URL.

  3. Verify that your abandoned checkout recovery emails are configured to your liking on the Checkout page.

Edit the abandoned checkout recovery notification

To edit your abandoned checkout recovery notification:

  1. In the Orders, click Abandoned checkout:

    Abandoned checkout list

  2. Find the line that includes:

    <td class="button__cell"><a href="{{ url }}" class="button__text">Complete your purchase</a></td>

    And the line that includes {{ shop.url }}:

    Abandoned checkout replace

  3. Copy the code snippet below:

    {% if url contains '?' %}
      {{ url | append: '&discount=ABC' }}
      {% else %}
      {{ url | append: '?&discount=ABC' }}
    {% endif %}
  4. Paste the code snippet to replace {{ url }}, and {{ shop.url }}.

  5. Replace ABC in the example above with your discount code, for example WelcomeBack.

  6. Click Save.

Now all abandoned checkout recovery emails will have urls ending in discount=ABC and that discount will be applied to their checkout automatically. Make sure you have set up your discount code in order for it to apply properly.

Want to discuss this page?

Visit the Shopify Community

Ready to start selling online with Shopify?

Try it free