Fulfillment failure email with Mechanic.

Mechanic is the one-tool-does-it-all automation app for Shopify. :)

Fulfillment failure email

by Isaac Bowen (team@usemechanic.com)

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 when a fulfillment event is created. Configuration includes email recipient.

15-day free trial – unlimited tasks

Developer details

Events
when a fulfillment event is created (shopify/fulfillment_events/create)
Options
email recipient (required)
Script
{% 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 %}
Yep, that’s just Liquid! If this is interesting to you, check out our documentation! Mechanic is hugely developer-friendly. :)