Send a follow-up email after order cancellation, with Mechanic.

Mechanic is an automation development platform for Shopify. :)

Send a follow-up email after order cancellation

by Isaac Bowen (team@usemechanic.com)

Use this task to easily check in on customers, after an order of theirs is cancelled. Optionally, queue up the email for a certain number of hours from the time of cancellation.

Runs when an order is cancelled. Configuration includes only send for first time customers, hours to wait after cancellation, email subject, and email body.

15-day free trial – unlimited tasks

Documentation

Use this task to easily check in on customers, after an order of theirs is cancelled. Optionally, queue up the email for a certain number of hours from the time of cancellation.

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

Events
when an order is cancelled (shopify/orders/cancelled)
Options
only send for first time customers (boolean), hours to wait after cancellation (number), email subject (required), email body (multiline, required)
Script
{% comment %}
  Preferred option order:

  {{ options.only_send_for_first_time_customers__boolean }}
  {{ options.hours_to_wait_after_cancellation__number }}
  {{ options.email_subject__required }}
  {{ options.email_body__multiline_required }}
{% endcomment %}

{% assign order_qualifies = false %}

{% if order.email != blank %}
  {% if options.only_send_for_first_time_customers__boolean %}
    {% if order.customer.reload.orders_count == 1 %}
      {% assign order_qualifies = true %}
    {% endif %}
  {% else %}
    {% assign order_qualifies = true %}
  {% endif %}
{% endif %}

{% if event.preview or order_qualifies %}
  {% action "email" %}
    {
      "to": {{ order.email | json }},
      "subject": {{ options.email_subject__required | json }},
      "body": {{ options.email_body__multiline_required | newline_to_br | json  }},
      "reply_to": {{ shop.customer_email | json }},
      "from_display_name": {{ shop.name | json }}
    }
  {% endaction %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Email subject
Following up on order {{ order.name }}
Email body
Hello,

We received your cancellation. Is there anything else we can do for you?

Thanks,
{{ shop.name  }}