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.
On this page
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:
Create a percentage or fixed amount discount code according to the type of promotion that you want to offer.
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.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.
- From your Shopify admin, go to Settings > Notifications.
- From the Shopify app, go to Store > Settings.
- Under Store settings, tap Notifications.
- From the Shopify app, go to Store > Settings.
- Under Store settings, tap Notifications.
Under Orders, click Abandoned checkout.
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>
- Copy the code snippet below:
{% if url contains '?' %}{{ url | append: '&discount=ABC' }}{% else %}{{ url | append: '?discount=ABC' }}{% endif %}
Paste the code snippet to replace
{{ url }}
.Find the line that includes the following code:
<td class="link__cell">or <a href="{{ shop.url }}">Visit our store</a></td>
- Copy the code snippet below:
{{ shop.url | append: '/discount/ABC' }}
Paste the code snippet to replace
{{ shop.url }}
.Replace each instance of
ABC
with your discount code, for exampleWelcomeBack
. 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>
- 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.