Email someone specific based on a new order's customer tags, with Mechanic.

Mechanic is a development and ecommerce automation platform for Shopify. :)

Email someone specific based on a new order's customer tags

Use customer tags to assign staff email addresses to specific customers. When a new order arrives from a customer who has an assignment tag, this task will email the related staff member.

Runs Occurs whenever an order is created. Configuration includes customer tags and assigned email recipients, email subject, and email body.

15-day free trial – unlimited tasks

Documentation

Use customer tags to assign staff email addresses to specific customers. When a new order arrives from a customer who has an assignment tag, this task will email the related staff member.

Fill in the "Customer tags and assigned email recipients" option with customer tags on the left (case-insensitive), and staff email addresses on the right. When this task registers a newly-created order with a customer tag that's found in the list, it will send an email to the appropriate email address. If multiple assignment tags are found for the customer, the email will be sent to all related staff members.

Developer details

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?)

Open source
View on GitHub to contribute to this task
Subscriptions
shopify/orders/create
Tasks use subscriptions to sign up for specific kinds of events. Learn more
Options
customer tags and assigned email recipients (keyval, required), email subject (required), email body (required, multiline)
Code
{% assign customer_tags = order.customer.tags | downcase | split: ", " %}

{% assign email_recipients = array %}

{% for keyval in options.customer_tags_and_assigned_email_recipients__keyval_required %}
  {% assign assigned_tag = keyval[0] | downcase %}
  {% assign assigned_email = keyval[1] %}

  {% if customer_tags contains assigned_tag %}
    {% assign email_recipients[email_recipients.size] = assigned_email %}
  {% endif %}
{% endfor %}

{% if event.preview or email_recipients != empty %}
  {% action "email" %}
    {
      "to": {{ email_recipients | join: ", " | json }},
      "subject": {{ options.email_subject__required | json }},
      "body": {{ options.email_body__required_multiline | newline_to_br | json }},
      "reply_to": {{ shop.customer_email | json }},
      "from_display_name": {{ shop.name | json }}
    }
  {% endaction %}
{% endif %}
Task code is written in Mechanic Liquid, an extension of open-source Liquid enhanced for automation. Learn more
Defaults
Email subject
Order {{ order.name }} from your customer, {{ order.email }}
Email body
Hello,

Order {{ order.name }} has arrived from {{ order.customer.first_name | default: "(first name)" }} {{ order.customer.last_name | default: "(last name)" }} ({{ order.email }}).

<a href="https://{{ shop.domain }}/admin/orders/{{ order.id }}">View this order in Shopify</a>

Thanks,
Mechanic, for {{ shop.name }}