Remind customers that their order is on the way
Do you ship custom items, or do you have a lengthy turnaround time on your orders? Use this task to automatically re-assure customers that their order is in the queue, to be shipped as soon as possible. By default, this task sends an email 10 days (or a number you configure) after the order is paid, as long as the order remains fully paid, unfulfilled, and un-cancelled. Optionally, configure tags to add to the order and/or customer, to be added when the email is sent, and choose whether to only send reminders on weekdays.
Try this taskWhen it runs
- Occurs whenever an order is paid
- Occurs whenever user/order/customer_reminder is triggered
What you choose
- Number of days to wait
- Only send reminders on weekdays
- Email subject
Show 3 more
- Email body
- Tag to add to order
- Tag to add to customer
Documentation
Do you ship custom items, or do you have a lengthy turnaround time on your orders? Use this task to automatically re-assure customers that their order is in the queue, to be shipped as soon as possible. By default, this task sends an email 10 days (or a number you configure) after the order is paid, as long as the order remains fully paid, unfulfilled, and un-cancelled. Optionally, configure tags to add to the order and/or customer, to be added when the email is sent, and choose whether to only send reminders on weekdays.
Use the variables ORDER_NUMBER and CUSTOMER_FIRST_NAME to insert each of these values into your email subject and body respectively.
Note: When the "Only send reminders on weekdays" option is chosen, any emails that would have been sent on a weekend are instead emailed the following Monday.
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
user/order/customer_reminder
How task subscriptions work
Option types and flags
- Number of days to wait (number, required)
- Only send reminders on weekdays (boolean)
- Email subject (required)
- Email body (multiline, required)
Task code
{% if event.topic == "shopify/orders/paid" %}
{% if event.preview %}
{% assign order = hash %}
{% assign order["admin_graphql_api_id"] = "gid://shopify/Order/1234567890" %}
{% assign order["fulfillment_status"] = nil %}
{% endif %}
{% if order.fulfillment_status == blank or order.fulfillment_status == "partial" %}
{% assign one_day_in_seconds = 60 | times: 60 | times: 24 %}
{% assign days_to_wait = options.number_of_days_to_wait__number_required | default: 10 %}
{% assign days_to_wait_in_seconds = days_to_wait | times: one_day_in_seconds %}
{% assign run_at = "now" | date: "%s" | plus: days_to_wait_in_seconds %}
{% if options.only_send_reminders_on_weekdays__boolean %}
{% assign run_at_day = run_at | date: "%w" %}
{% if run_at_day == "0" %}{% comment %}-- Sunday --{% endcomment %}
{% assign run_at = run_at | plus: one_day_in_seconds %}
{% elsif run_at_day == "6" %}{% comment %}-- Saturday --{% endcomment %}
{% assign run_at = run_at | plus: one_day_in_seconds | plus: one_day_in_seconds %}
{% endif %}
{% endif %}
{% action "event" %}
{
"topic": "user/order/customer_reminder",
"task_id": {{ task.id | json }},
"run_at": {{ run_at | json }},
"data": {
"order_id": {{ order.admin_graphql_api_id | json }}
}
}
{% endaction %}
{% endif %}
{% elsif event.topic == "user/order/customer_reminder" %}
{% assign order_id = event.data.order_id %}
{% capture order_query %}
query {
order(id: {{ order_id | json }}) {
id
name
email
fullyPaid
displayFulfillmentStatus
cancelledAt
customer {
id
firstName
}
}
}
{% endcapture %}
{% assign order_result = order_query | shopify %}
{% if event.preview %}
{% capture order_result_json %}
{
"data": {
"order": {
"id": "gid://shopify/Order/1234567890",
"name": "#1234",
"email": "charlie.customer@example.com",
"fullyPaid": true,
"displayFulfillmentStatus": "UNFULFILLED",
"cancelledAt": null,
"customer": {
"id": "gid://shopify/Customer/1234567890",
"firstName": "Charlie"
}
}
}
}
{% endcapture %}
{% assign order_result = order_result_json | parse_json %}
{% endif %}
{% assign order = order_result.data.order %}
{% if order.cancelledAt == blank and order.fullyPaid %}
{% if order.displayFulfillmentStatus == "UNFULFILLED" or order.displayFulfillmentStatus == "PARTIALLY_FULFILLED" %}
{% assign customer_first_name = order.customer.firstName | default: "there" %}
{% assign email_subject = options.email_subject__required | replace: "ORDER_NAME", order.name %}
{% assign email_body = options.email_body__multiline_required | strip | newline_to_br | replace: "CUSTOMER_FIRST_NAME", customer_first_name %}
{% action "email" %}
{
"to": {{ order.email | json }},
"subject": {{ email_subject | json }},
"body": {{ email_body | json }},
"reply_to": {{ shop.customer_email | json }},
"from_display_name": {{ shop.name | json }}
}
{% endaction %}
{% if options.tag_to_add_to_order != blank %}
{% action "shopify" %}
mutation {
tagsAdd(
id: {{ order.id | json }}
tags: {{ options.tag_to_add_to_order | json }}
) {
userErrors {
field
message
}
}
}
{% endaction %}
{% endif %}
{% if options.tag_to_add_to_customer != blank %}
{% action "shopify" %}
mutation {
tagsAdd(
id: {{ order.customer.id | json }}
tags: {{ options.tag_to_add_to_customer | json }}
) {
userErrors {
field
message
}
}
}
{% endaction %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
Mechanic Liquid reference
Default option values
- Number of days to wait
10- Only send reminders on weekdays
false- Email subject
Don't worry – ORDER_NAME is still coming!- Email body
Hi CUSTOMER_FIRST_NAME, Thank you for your order! We're writing to let you know that your order is still enqueued, and will be shipped to you as soon as it's ready. :) Just reply to this email if you have any questions. Thanks, {{ shop.name }}