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

Mechanic is an automation and development platform for Shopify. :)

Flag orders that aren't fulfilled after several days

by Isaac Bowen (team@usemechanic.com)

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 2 days after an order is paid. Configuration includes 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

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. 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, Gurus, 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.

Events
2 days after an order is paid (shopify/orders/paid+2.days)
Options
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)
Script
{% unless false and event.preview %}
  {% assign order = order.reload %}
{% endunless %}

{% assign order_qualifies = false %}
{% if order.fulfillment_status == blank and order.cancelled_at == blank %}
  {% assign order_qualifies = true %}
{% endif %}

{% if event.preview or order_qualifies %}
  {% if options.tag_to_add != blank %}
    {
      "action": {
        "type": "shopify",
        "options": [
          "update",
          [
            "order",
            {{ order.id | json }}
          ],
          {
            "tags": {{ order.tags | add_tag: options.tag_to_add | json }}
          }
        ]
      }
    }
  {% 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": {
        "type": "email",
        "options": {
          "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 }}
        }
      }
    }
  {% 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": {
        "type": "email",
        "options": {
          "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 }}
        }
      }
    }
  {% endif %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
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