Flag orders that aren't fulfilled after several days, with Mechanic.

Mechanic is a development and ecommerce automation platform for Shopify. :)

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.

Runs Occurs whenever an order is paid, with a 2 day delay. Configuration includes include partially fulfilled orders, tag to add, staff notification recipient, send the customer an email, customer email subject, customer email body, and days to wait before followup.

15-day free trial – unlimited tasks

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.

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, 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.

(By the way, have you seen our documentation? Have you joined the Slack community?)

Open source
View on GitHub to contribute to this task
Subscriptions
shopify/orders/paid+{{ options.days_to_wait_before_followup__number_required }}.days
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Options
include partially fulfilled orders (boolean), tag to add, staff notification recipient (email), send the customer an email (boolean), customer email subject, customer email body (multiline), days to wait before followup (number, required)
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 %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more
Defaults
Tag to add
unfulfilled-needs-attention
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