Mechanic is a development and ecommerce automation platform for Shopify. :)
This task monitors order tags, and sends out an email that you configure whenever a certain tag is added. Supports email templates, and sending to custom recipients.
Runs Occurs whenever an order is updated. Configuration includes email trigger tag, email sent tag, email subject, and email body html.
This task monitors order tags, and sends out an email that you configure whenever a certain tag is added. Supports email templates, and sending to custom recipients.
This task monitors order tags, and sends out an email that you configure whenever a certain tag is added.
By default, this email will be sent to the address on file for the order. However, you can specify a custom recipient by tagging the order with "email:custom@example.com". (This example assumes you use "email" as your email trigger tag.)
When this task sends out an email, it removes the tag that triggered the message, replacing it with the email used for delivery, prefixed with the "email sent" tag.
Feel free to tag the order with multiple trigger tags at once, e.g. "email", "email:customer@example.com", "email:sales@example.com". After processing, Mechanic will leave the task tagged "sent", "sent:customer@example.com:sent", "sent:sales@example", leaving any and all other tags untouched.
Please note: Shopify restricts order tags to 40 characters in length.
To re-use your store's confirmation email template, or to use any other email template, configure your email template with Mechanic, and add the Mechanic email template name to your task.
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?)
shopify/orders/updated
{% if event.preview %} {% assign order = '{"admin_graphql_api_id":"gid://shopify/Order/1234567890"}' | parse_json %} {% assign order["email"] = "customer@example.com" %} {% assign order["tags"] = options.email_trigger_tag__required %} {% endif %} {% assign email_recipient = order.email %} {% assign email_trigger_root = options.email_trigger_tag__required %} {% assign email_trigger_root_to_match = email_trigger_root | downcase %} {% assign email_sent_root = options.email_sent_tag__required %} {% assign email_sent_root_to_match = email_sent_root | downcase %} {% assign email_recipients = array %} {% assign order_tags_to_add = array %} {% assign order_tags_to_remove = array %} {% assign order_tags = order.tags | downcase | split: ", " %} {% for order_tag in order_tags %} {% assign new_email_recipient = nil %} {% assign parts = order_tag | downcase | split: ":" %} {% if parts[0] == email_trigger_root_to_match %} {% if parts.size == 1 %} {% assign new_email_recipient = order.email %} {% elsif parts[1] contains "@" %} {% assign new_email_recipient = parts[1] %} {% endif %} {% endif %} {% if new_email_recipient != blank %} {% assign email_recipients[email_recipients.size] = new_email_recipient %} {% assign order_tags_to_remove[order_tags_to_remove.size] = order_tag %} {% assign order_tags_to_add[order_tags_to_add.size] = email_sent_root | append: ":" | append: new_email_recipient %} {% endif %} {% endfor %} {% for email_recipient in email_recipients %} {% action "email" %} { "to": {{ email_recipient | json }}, "subject": {{ options.email_subject__required | json }}, "body": {{ options.email_body_html__required_multiline_code | strip | json }}, "reply_to": {{ shop.customer_email | json }}, "from_display_name": {{ shop.name | json }} } {% endaction %} {% endfor %} {% if order_tags_to_add != blank or order_tags_to_remove != blank %} {% action "shopify" %} mutation { {% if order_tags_to_add != blank %} tagsAdd( id: {{ order.admin_graphql_api_id | json }} tags: {{ order_tags_to_add | json }} ) { userErrors { field message } } {% endif %} {% if order_tags_to_remove != blank %} tagsRemove( id: {{ order.admin_graphql_api_id | json }} tags: {{ order_tags_to_remove | json }} ) { userErrors { field message } } {% endif %} } {% endaction %} {% endif %}
sent
About your order: {{ order.name }}