Automatically apply discounts to abandoned checkout recovery emails

You can automatically apply a discount to your abandoned checkout recovery emails. When you apply a discount to your abandoned checkout emails, your customers are emailed a pre-filled cart at a discounted price. Customers only need to enter their payment details to complete checkout.

Considerations

Before you begin, consider the following:

  • A message explaining to the customer that they've received the discount isn't automatically added with the code. To include a message about the discount code in the abandoned checkout recovery email, add a message to the template.
  • Avoid using special characters in your discount names so that your discount names add correctly to your store's checkout URL.

Step 1: Set up a discount code

Steps:

  1. Create a percentage or fixed amount discount code according to the type of promotion that you want to offer.
  2. Make sure to make a note of the name that 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.
  3. Verify that your abandoned checkout recovery emails are configured to your liking on the Checkout page.

Step 2: Edit the abandoned checkout recovery notification

Add a message to your customer in the body of the abandoned cart recovery template. This lets your customers know that you're giving them the discount.

Desktop
  1. From your Shopify admin, go to Settings > Notifications.
  2. Under Orders, click Abandoned checkout.
  3. In the Email body (HTML) area, find the line that includes the following code:
<td class="button__cell"><a href="{{ url }}" class="button__text">Items in your cart</a></td>
  1. Copy the code snippet below:
{% if url contains '?' %}{{ url | append: '&discount=ABC' }}{% else %}{{ url | append: '?discount=ABC' }}{% endif %}
  1. Paste the code snippet to replace {{ url }}.
  2. Find the line that includes the following code:
<td class="link__cell">or <a href="{{ shop.url }}">Visit our store</a></td>
  1. Copy the code snippet below:
{{ shop.url | append: '/discount/ABC' }}
  1. Paste the code snippet to replace {{ shop.url }}.
  2. Replace each instance of ABC with your discount code, for example WelcomeBack. Your code should look like this:
<tr>
  <td class="actions__cell">
    <table class="button main-action-cell">
      <tr>
        <td class="button__cell"><a href="{% if url contains '?' %}{{ url | append: '&discount=WelcomeBack' }}{% else %}{{ url | append: '?discount=WelcomeBack' }}{% endif %}" class="button__text">Items in your cart</a></td>
      </tr>
    </table>
    {% if shop.url %}
    <table class="link secondary-action-cell">
      <tr>
        <td class="link__cell">or <a href="{{ shop.url | append: '/discount/WelcomeBack' }}">Visit our store</a></td>
      </tr>
    </table>
    {% endif %}
  </td>
</tr>
  1. Click Save.
iPhone
  1. From the Shopify app, tap the button, and then tap Settings.
  2. In the Store settings section, tap Notifications.
  3. Under Orders, click Abandoned checkout.
  4. In the Email body (HTML) area, find the line that includes the following code:
<td class="button__cell"><a href="{{ url }}" class="button__text">Items in your cart</a></td>
  1. Copy the code snippet below:
{% if url contains '?' %}{{ url | append: '&discount=ABC' }}{% else %}{{ url | append: '?discount=ABC' }}{% endif %}
  1. Paste the code snippet to replace {{ url }}.
  2. Find the line that includes the following code:
<td class="link__cell">or <a href="{{ shop.url }}">Visit our store</a></td>
  1. Copy the code snippet below:
{{ shop.url | append: '/discount/ABC' }}
  1. Paste the code snippet to replace {{ shop.url }}.
  2. Replace each instance of ABC with your discount code, for example WelcomeBack. Your code should look like this:
<tr>
  <td class="actions__cell">
    <table class="button main-action-cell">
      <tr>
        <td class="button__cell"><a href="{% if url contains '?' %}{{ url | append: '&discount=WelcomeBack' }}{% else %}{{ url | append: '?discount=WelcomeBack' }}{% endif %}" class="button__text">Items in your cart</a></td>
      </tr>
    </table>
    {% if shop.url %}
    <table class="link secondary-action-cell">
      <tr>
        <td class="link__cell">or <a href="{{ shop.url | append: '/discount/WelcomeBack' }}">Visit our store</a></td>
      </tr>
    </table>
    {% endif %}
  </td>
</tr>
  1. Click Save.
Android
  1. From the Shopify app, tap the button, and then tap Settings.
  2. In the Store settings section, tap Notifications.
  3. Under Orders, click Abandoned checkout.
  4. In the Email body (HTML) area, find the line that includes the following code:
<td class="button__cell"><a href="{{ url }}" class="button__text">Items in your cart</a></td>
  1. Copy the code snippet below:
{% if url contains '?' %}{{ url | append: '&discount=ABC' }}{% else %}{{ url | append: '?discount=ABC' }}{% endif %}
  1. Paste the code snippet to replace {{ url }}.
  2. Find the line that includes the following code:
<td class="link__cell">or <a href="{{ shop.url }}">Visit our store</a></td>
  1. Copy the code snippet below:
{{ shop.url | append: '/discount/ABC' }}
  1. Paste the code snippet to replace {{ shop.url }}.
  2. Replace each instance of ABC with your discount code, for example WelcomeBack. Your code should look like this:
<tr>
  <td class="actions__cell">
    <table class="button main-action-cell">
      <tr>
        <td class="button__cell"><a href="{% if url contains '?' %}{{ url | append: '&discount=WelcomeBack' }}{% else %}{{ url | append: '?discount=WelcomeBack' }}{% endif %}" class="button__text">Items in your cart</a></td>
      </tr>
    </table>
    {% if shop.url %}
    <table class="link secondary-action-cell">
      <tr>
        <td class="link__cell">or <a href="{{ shop.url | append: '/discount/WelcomeBack' }}">Visit our store</a></td>
      </tr>
    </table>
    {% endif %}
  </td>
</tr>
  1. Click Save.

Now all abandoned checkout recovery emails will have URLs ending in discount=WelcomeBack or /discount/WelcomeBack and that discount is automatically applied to their checkout. Make sure you have set up your discount code in order for it to apply properly.

Can’t find the answers you’re looking for? We’re here to help.