Email customer when their order is paid, with Mechanic.

Mechanic is a development platform for Shopify. :)

Email customer when their order is paid

by Isaac Bowen (team@usemechanic.com)

Quickly send a thank-you email (or any other sort of follow-up email) to your customers, as soon as their order is paid. (Optionally, require one or more order tags to be present, in order for the email to be sent.) And it's super easy to add a delay – set the task to subscribe "shopify/orders/paid+2.days" or "shopify/orders/paid+1.week" instead to create a thoughtful just-checking-back-in-with-you message. :)

Runs when an order is paid. Configuration includes required order tags at the time of payment, email subject, and email body.

15-day free trial – unlimited tasks

Documentation

Quickly send a thank-you email (or any other sort of follow-up email) to your customers, as soon as their order is paid. (Optionally, require one or more order tags to be present, in order for the email to be sent.) And it's super easy to add a delay – set the task to subscribe "shopify/orders/paid+2.days" or "shopify/orders/paid+1.week" instead to create a thoughtful just-checking-back-in-with-you message. :)

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 paid (shopify/orders/paid)
Options
required order tags at the time of payment (array), email subject (required), email body (multiline, required)
Script
{% if event.preview %}
  {% assign order = hash %}
  {% assign order["email"] = "customer@example.com" %}
  {% assign order["tags"] = options.required_order_tags_at_the_time_of_payment__array | join: ", " %}
{% endif %}

{% assign order_qualifies = true %}

{% if order.email == blank %}
  {% log message: "Order is missing an email address; skipping" %}
  {% assign order_qualifies = false %}
{% endif %}

{% if options.required_order_tags_at_the_time_of_payment__array != blank %}
  {% assign order_tags = order.tags | split: ", " %}
  {% for required_tag in options.required_order_tags_at_the_time_of_payment__array %}
    {% unless order_tags contains required_tag %}
      {% log message: "Order is missing a required tag; skipping", missing_tag: required_tag, order_tags: order_tags %}
      {% assign order_qualifies = false %}
    {% endunless %}
  {% endfor %}
{% endif %}

{% if order_qualifies %}
  {% action "email" %}
    {
      "to": {{ order.email | json }},
      "subject": {{ options.email_subject__required | json }},
      "body": {{ options.email_body__multiline_required | strip | 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
Order #{{ order.order_number }} is paid - thank you!