Send email when an order comes in, with Mechanic.

Mechanic is an automation development platform for Shopify. :)

Send email when an order comes in

by Isaac Bowen (team@usemechanic.com)

Use this task to notify staff (or suppliers, or anyone!) of incoming orders. Optionally, choose to only be notified when orders are paid, or only for orders that contain at least one product with a certain tag.

Runs when an order is created. Configuration includes only for orders including this product tag, email recipients, email subject, email body, and only for paid orders.

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
only for orders including this product tag, email recipients (required), email subject (required), email body (required, multiline), only for paid orders (boolean)
Script
{% assign order_qualifies = false %}
{% if options.only_for_orders_including_this_product_tag == blank %}
  {% assign order_qualifies = true %}
{% else %}
  {% assign order_product_tags = order.line_items | map: "product" | map: "tags" | join: ", " | split: ", " | sort | uniq %}
  {% if order_product_tags contains options.only_for_orders_including_this_product_tag %}
    {% assign order_qualifies = true %}
  {% endif %}
{% endif %}

{% if event.preview or order_qualifies %}
  {
    "action": {
      "type": "email",
      "options": {
        "to": {{ options.email_recipients__required | json }},
        "subject": {{ options.email_subject__required | strip | json }},
        "body": {{ options.email_body__required_multiline | newline_to_br | strip | json }},
        "reply_to": {{ shop.customer_email | json }},
        "from_display_name": {{ shop.name | json }}
      }
    }
  }
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Email recipients
sales@example.com, production@example.com
Email subject
New {{ order.financial_status }} order: {{ order.name }}
Email body
Hi team,

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

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

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