Mechanic Get Mechanic
Task library

Send a follow-up email after order cancellation

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.

Try this task

When it runs

Occurs whenever an order is cancelled

What you choose

  • Only send for first time customers
  • Hours to wait after cancellation
  • Email subject
  • Email body
Task code and subscriptions

You can edit the Liquid code after installing this task. View on GitHub or ask a question in the Mechanic Slack community.

Subscriptions

shopify/orders/cancelled{% if options.hours_to_wait_after_cancellation__number != blank %}+{{ options.hours_to_wait_after_cancellation__number }}.hours{% endif %}
How task subscriptions work

Option types and flags

Task code

{% 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 Liquid reference

Default option values

Only send for first time customers
false
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  }}