Mechanic Get Mechanic
Task library

Flag orders that aren't fulfilled after several days

It's critical to stay on top of any orders that aren't properly fulfilled – and your customers care, too! Use this task to auto-tag orders, to email yourself a reminder, and optionally to send customers a little reassurance message, if an order hasn't been fulfilled a configurable number of days after payment.

Try this task

When it runs

Occurs whenever an order is paid, with a 2 day delay

What you choose

  • Include partially fulfilled orders
  • Tag to add
  • Staff notification recipient
Show 4 more
  • Send the customer an email
  • Customer email subject
  • Customer email body
  • Days to wait before followup

Documentation

It's critical to stay on top of any orders that aren't properly fulfilled – and your customers care, too! Use this task to auto-tag orders, to email yourself a reminder, and optionally to send customers a little reassurance message, if an order hasn't been fulfilled a configurable number of days after payment.

This task watches for paid orders, and schedules a follow-up check for some number of days later (you choose!).

Configure this task with a tag to automatically apply that tag on schedule, if the order remains unfulfilled. (Or if the order is partially fulfilled, if you've configured the task for this option.) Add a staff email address to receive a notification message. And, optionally, send a reassuring email to the customer, letting them know that the order is on its way, and with specifics about what's not in stock.

This task won't tag or send emails if the order is partially fulfilled, if the order has been restocked, or if the order has been cancelled.

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+{{ options.days_to_wait_before_followup__number_required }}.days
How task subscriptions work

Option types and flags

Task code

{% if event.preview %}
  {% assign order = hash %}
  {% assign order["admin_graphql_api_id"] = "gid://shopify/Order/1234567890" %}
  {% assign order["fulfillment_status"] = nil %}
  {% assign order["cancelled_at"] = nil %}
  {% assign order["email"] = "customer@example.com" %}
  {% assign order["name"] = "#1234" %}
  {% assign order["id"] = 1234567890 %}
{% else %}
  {% assign order = order.reload %}
{% endif %}

{% if order == nil %}
  {% comment %}
    Happens when the order has been deleted
  {% endcomment %}

  {% log "Order has been deleted; skipping" %}
  {% break %}
{% endif %}

{% assign order_qualifies = false %}

{% if order.fulfillment_status == blank %}
  {% assign order_qualifies = true %}
{% elsif options.include_partially_fulfilled_orders__boolean and order.fulfillment_status == "partial" %}
  {% assign order_qualifies = true %}
{% endif %}

{% if order.cancelled_at != blank %}
  {% assign order_qualifies = false %}
{% endif %}

{% if order_qualifies %}
  {% if options.tag_to_add != blank %}
    {% action "shopify" %}
      mutation {
        tagsAdd(
          id: {{ order.admin_graphql_api_id | json }}
          tags: {{ options.tag_to_add | json }}
        ) {
          userErrors {
            field
            message
          }
        }
      }
    {% endaction %}
  {% endif %}

  {% if options.staff_notification_recipient__email != blank %}
    {% capture email_body %}
      Hello,

      Order {{ order.name }} (for {{ order.email | default: "unknown email" }}) is still unfulfilled. Manage this order:

      https://{{ shop.domain }}/admin/orders/{{ order.id }}

      Thanks,
      Mechanic (for {{ shop.name }})
    {% endcapture %}

    {% action "email" %}
      {
        "to": {{ options.staff_notification_recipient__email | json }},
        "subject": {{ "Order " | append: order.name | append: " is still unfulfilled" | json }},
        "body": {{ email_body | strip | unindent | newline_to_br | json }},
        "reply_to": {{ shop.customer_email | json }},
        "from_display_name": {{ shop.name | json }}
      }
    {% endaction %}
  {% endif %}

  {% assign order_email_qualified = false %}
  {% if event.preview or order.email != blank %}
    {% assign order_email_qualified = true %}
  {% endif %}

  {% if options.send_the_customer_an_email__boolean and order_email_qualified %}
    {% action "email" %}
      {
        "to": {{ order.email | json }},
        "subject": {{ options.customer_email_subject | strip | json }},
        "body": {{ options.customer_email_body__multiline | strip | newline_to_br | json }},
        "reply_to": {{ shop.customer_email | json }},
        "from_display_name": {{ shop.name | json }}
      }
    {% endaction %}
  {% endif %}
{% endif %}
Mechanic Liquid reference

Default option values

Tag to add
unfulfilled-needs-attention
Send the customer an email
false
Customer email subject
Order {{ order.name }} is (still) on its way!
Customer email body
Hi {{ order.customer.first_name | default: "there" }},

Thanks for your order! We're still working on getting everything to you.

If you have any questions, just reply to this message.

Thanks,
The team at {{ shop.name }}
Days to wait before followup
2