Mechanic is an automation development platform for Shopify. :)
Improve your customer relationships without complicated your workflow - use this task to send automatic emails whenever your staff adds a certain tag to an order. (Mechanic will add another tag to your order when the email is sent, for visibility.)
Runs when an order is created and when an order is updated. Configuration includes tag to watch for, email subject, email body, and ignore orders older than this task.
This task monitors incoming orders, and updates to existing orders, looking for the tag of your choice. When the tag is detected, this task will send an email to the address on file for that order.
Important notes
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.
{% comment %} Establish option order: {{ options.tag_to_watch_for__required }} {{ options.email_subject__required }} {{ options.email_body__required_multiline }} {{ options.ignore_orders_older_than_this_task__boolean }} {% endcomment %} {% assign tag_to_watch_for = options.tag_to_watch_for__required %} {% capture email_sent_tag %}{{ tag_to_watch_for }}-email-sent{% endcapture %} {% assign order_tags = order.tags | split: ", " %} {% assign order_qualifies = false %} {% if order_tags contains tag_to_watch_for %} {% unless order_tags contains email_sent_tag %} {% assign order_qualifies = true %} {% endunless %} {% endif %} {% if order_qualifies and options.ignore_orders_older_than_this_task__boolean %} {% assign order_created_at = order.created_at | date: "%s" %} {% assign task_created_at = task.created_at | date: "%s" %} {% if order_created_at < task_created_at %} {% assign order_qualifies = false %} {% endif %} {% endif %} {% if event.preview or order_qualifies %} {% action "email" %} { "to": {{ order.email | json }}, "subject": {{ options.email_subject__required | json }}, "body": {{ options.email_body__required_multiline | strip | newline_to_br | json }}, "reply_to": {{ shop.customer_email | json }}, "from_display_name": {{ shop.name | json }} } {% endaction %} {% action "shopify" %} mutation { tagsAdd( id: {% if event.preview %}"gid://shopify/Order/1234567890"{% else %}{{ order.admin_graphql_api_id | json }}{% endif %} tags: {{ email_sent_tag | json }} ) { userErrors { field message } } } {% endaction %} {% endif %}
in-production
Order {{ order.name }} is in production
Hi {{ order.customer.first_name | default: "there" }}, Your order is in the shop! We'll be in touch when it's been shipped. Thanks, The team at {{ shop.name }}
true