Send an email alert on fulfillment failure, with Mechanic.

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

Send an email alert on fulfillment failure

Get an alert email sent to you when your tracking service reports a fulfillment failure. This email contains a link to the order details, so you can jump in and resolve the issue for the customer without losing any time.

Runs Occurs whenever a fulfillment event is created. Configuration includes email recipient.

15-day free trial – unlimited tasks

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/fulfillment_events/create
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Options
email recipient (required)
Code
{% if event.preview or fulfillment_event.status == "failure" %}
  {% capture email_subject %}
    Fulfillment failed for order #{% if event.preview %}12345{% else %}{{ fulfillment_event.order.order_number }}{% endif %}
  {% endcapture %}

  {% capture email_body %}
    Hello,

    {% if event.preview %}FedEx{% else %}{{ fulfillment_event.fulfillment.tracking_company }}{% endif %} has reported a fulfillment failure for order #{% if event.preview %}12345{% else %}{{ fulfillment_event.order.order_number }}{% endif %}. Here's the message they included:

    {% if fulfillment_event.message != blank %}> {{ fulfillment_event.message }}{% else %}(no message){% endif %}

    View this order's details in Shopify:

    https://{{ shop.myshopify_domain }}/admin/orders/{% if event.preview %}1234567890{% else %}{{ fulfillment_event.order.id }}{% endif %}

    Thanks,

    - Mechanic, for {{ shop.name }}
  {% endcapture %}

  {
    "action": {
      "type": "email",
      "options": {
        "to": {{ options.email_recipient__required | json }},
        "subject": {{ email_subject | unindent | json }},
        "body": {{ email_body | unindent | newline_to_br | json }},
        "from_display_name": {{ shop.name | json }}
      }
    }
  }
{% endif %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more