Email customer when their order is paid
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. :)
Try this taskWhen it runs
Occurs whenever an order is paid
What you choose
- Required order tags at the time of payment
- 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/paid
How task subscriptions work
Option types and flags
- Required order tags at the time of payment (array)
- Email subject (required)
- Email body (multiline, required)
Task code
{% 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 Liquid reference
Default option values
- Email subject
Order #{{ order.order_number }} is paid - thank you!