Notify a team when a tagged product is ordered with Mechanic.

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

Notify a team when a tagged product is ordered

by Isaac Bowen (team@usemechanic.com)

Quickly route order notifications to whichever teams need be alerted for a given order. Use product tags to mark products according to which team needs the alert, and add multiple copies of this task to alert different teams for different tags.

Runs when an order is created. Configuration includes required product tag, team email, email subject, and email body.

15-day free trial – unlimited tasks

Developer details

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.

Events
when an order is created (shopify/orders/create)
Options
required product tag (required), team email (required), email subject (required), email body (multiline, required)
Script
{% assign order_qualifies = false %}
{% assign order_product_tags = order.line_items | map: "product" | map: "tags" | join: ", " | split: ", " | sort | uniq %}
{% if order_product_tags contains options.required_product_tag__required %}
  {% assign order_qualifies = true %}
{% endif %}

{% if event.preview or order_qualifies %}
  {
    "action": {
      "type": "email",
      "options": {
        "to": {{ options.team_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 }}
      }
    }
  }
{% elsif order_qualifies == false %}
  {% capture log_message %}Order tags did not include {{ options.required_product_tag__required | json }} (found {{ order_product_tags | json }}){% endcapture %}
  {"log": {{ log_message }}}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Required product tag
requires-art
Team email
art-department@example.com
Email subject
Order {{ order.order_number }} requires custom artwork
Email body
Hello,

Please see details for order {{ order.order_number }}:

https://{{ shop.myshopify_domain }}/admin/orders/{{ order.id }}

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