Mechanic Get Mechanic
Task library

Remind customers after x days about unpaid orders

This task wait for a configurable number of days (or hours!) after an order placed, and – if the order is still unpaid – emails the customer, and optionally adds a tag to the order. This task only sends one email – it does not send repeating reminders.

Try this task

When it runs

Occurs whenever an order is created, with a 7 day delay

What you choose

  • Email subject
  • Email body
  • Tag to add to the order
  • Number of days to wait
  • Use hours instead of days
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/create+{{ options.number_of_days_to_wait__number_required | default: 7 }}.{% if options.use_hours_instead_of_days__boolean %}hours{% else %}days{% endif %}
How task subscriptions work

Option types and flags

Task code

{% assign email_subject = options.email_subject__required %}
{% assign email_body = options.email_body__multiline_required %}
{% assign tag_to_add_to_the_order = options.tag_to_add_to_the_order %}

{% comment %}
  -- requery the order since a delay is typically configured in the task
{% endcomment %}

{% capture query %}
  query {
    order(id: {{ order.admin_graphql_api_id | json }}) {
      id
      email
      cancelledAt
      displayFinancialStatus
      tags
    }
  }
{% endcapture %}

{% assign result = query | shopify %}

{% if event.preview %}
  {% capture result_json %}
    {
      "data": {
        "order": {
          "id": "gid://shopify/Order/1234567890",
          "email": "sample@example.com",
          "displayFinancialStatus": "PENDING"
        }
      }
    }
  {% endcapture %}

  {% assign result = result_json | parse_json %}
{% endif %}

{% assign order = result.data.order %}

{% comment %}
  -- don't send notification email if the order has no email, has been cancelled, or is no longer pending
{% endcomment %}

{% if order.email == blank or order.cancelledAt != blank or order.displayFinancialStatus != "PENDING" %}
  {% break %}
{% endif %}

{% comment %}
  -- send reminder email and tag the order if that option is configured
{% endcomment %}

{% action "email" %}
  {
    "to": {{ order.email | json }},
    "subject": {{ email_subject | json }},
    "body": {{ email_body | strip | newline_to_br | json }},
    "reply_to": {{ shop.customer_email | json }},
    "from_display_name": {{ shop.name | json }}
  }
{% endaction %}

{% if tag_to_add_to_the_order != blank %}
  {% action "shopify" %}
    mutation {
      tagsAdd(
        id: {{ order.id | json }}
        tags: {{ tag_to_add_to_the_order | json }}
      ) {
        userErrors {
          field
          message
        }
      }
    }
  {% endaction %}
{% endif %}
Mechanic Liquid reference

Default option values

Email subject
Don't forget! Order #{{ order.order_number }} still needs to be paid
Email body
Hi there,

Your payment is still required! Please get in touch at {{ shop.customer_email }} to proceed.

Thanks,
{{ shop.name }}
Number of days to wait
7
Use hours instead of days
false