Email customer when their order is tagged with Mechanic.

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

Email customer when their order is tagged

by Isaac Bowen (team@usemechanic.com)

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 updated. Configuration includes order tag, email subject, and email body.

15-day free trial – unlimited tasks

Developer details

Events
when an order is updated (shopify/orders/updated)
Options
order tag (required), email subject (required), email body (required, multiline)
Script
{% capture flag_tag %}{{ options.order_tag__required }}-email-sent{% endcapture %}

{% assign should_send_email = false %}
{% unless order.tags contains flag_tag %}
  {% assign should_send_email = true %}
{% endunless %}

{% if should_send_email or event.preview %}
  {
    "action": {
      "type": "email",
      "options": {
        "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 }}
      }
    }
  }

  {% capture tags_to_save %}{{ flag_tag }},{{ order.tags }}{% endcapture %}

  {
    "action": {
      "type": "shopify",
      "options": [
        "update",
        [
          "order",
          {{ order.id }}
        ],
        {
          "tags": {{ tags_to_save | json }}
        }
      ]
    }
  }
{% endif %}
Yep, that’s just Liquid! If this is interesting to you, check out our documentation! Mechanic is hugely developer-friendly. :)
Defaults
Email subject
Order {{ order.order_number }} has been updated!
Email body
Hey there,

Your order has been updated! :)

Thanks,
The {{ shop.name }} team