Mechanic is an automation development platform for Shopify. :)
Useful for keeping an eye on unexpected cancellations by third party shipping services.
Runs when a fulfillment is updated. Configuration includes email recipient, email subject, and email body.
This task performs two actions: one to send an email, and one to "remember" that an email has been sent. (Without this second action, this task would send an email every time a cancelled fulfillment is updated.)
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.
{% assign fulfillment_qualifies = false %} {% assign cache_key = task.id | append: fulfillment.id | sha256 %} {% if fulfillment.status == "cancelled" and cache[cache_key] == blank %} {% assign fulfillment_qualifies = true %} {% endif %} {% if event.preview or fulfillment_qualifies %} {% action "email" %} { "to": {{ options.email_recipient__email_required | json }}, "subject": {{ options.email_subject__required | json }}, "body": {{ options.email_body__multiline_required | strip | newline_to_br | json }}, "reply_to": {{ shop.customer_email | json }}, "from_display_name": {{ shop.name | json }} } {% endaction %} {% action "cache", "set", cache_key, true %} {% endif %}
A fulfillment for order {{ fulfillment.order.name | default: "an order" }} was cancelled
Hello, A fulfillment with {{ fulfillment.line_items.size }} line item(s) was cancelled. <a href="https://{{ shop.domain }}/admin/orders/{{ fulfillment.order.id }}">Manage this order in Shopify</a> Thanks, Mechanic, for {{ shop.name }}