Mechanic is a development and ecommerce automation platform for Shopify. :)
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 Occurs whenever an order is created. Configuration includes only for orders including this product tag, email recipients, email subject, email body, and only for paid orders.
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?)
{% if options.only_for_paid_orders__boolean %}
shopify/orders/paid
{% else %}
shopify/orders/create
{% endif %}{% assign only_for_orders_including_this_product_tag = options.only_for_orders_including_this_product_tag %}
{% assign email_recipients = options.email_recipients__required %}
{% assign email_subject = options.email_subject__required %}
{% assign email_body = options.email_body__required_multiline %}
{% if only_for_orders_including_this_product_tag == blank %}
{% assign order_qualifies = true %}
{% else %}
{% capture query %}
query {
order(id: {{ order.admin_graphql_api_id | json }}) {
lineItems(first: 250) {
nodes {
product {
tags
}
}
}
}
}
{% endcapture %}
{% assign result = query | shopify %}
{% if event.preview %}
{% capture result_json %}
{
"data": {
"order": {
"lineItems": {
"nodes": [
{
"product": {
"tags": {{ only_for_orders_including_this_product_tag | json }}
}
}
]
}
}
}
}
{% endcapture %}
{% assign result = result_json | parse_json %}
{% endif %}
{% for line_item in result.data.order.lineItems.nodes %}
{% if line_item.product.tags contains only_for_orders_including_this_product_tag %}
{% assign order_qualifies = true %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}
{% if order_qualifies %}
{% action "email" %}
{
"to": {{ email_recipients | json }},
"subject": {{ email_subject | json }},
"body": {{ email_body | newline_to_br | json }},
"reply_to": {{ shop.customer_email | json }},
"from_display_name": {{ shop.name | json }}
}
{% endaction %}
{% endif %}
sales@example.com, production@example.com
New {{ order.financial_status }} order: {{ order.name }}Hi team,
Please see details for order {{ order.name }}:
https://{{ shop.myshopify_domain }}/admin/orders/{{ order.id }}
Thanks,
- Mechanic, for {{ shop.name }}