Mechanic is a development and ecommerce automation platform for Shopify. :)
Use this task to apply the same categorizations you use for your customers. Useful for pre-approving customers, and then quickly sorting your orders based on that pre-approval. Optionally, configure this task to only copy certain tags from customers to their orders.
Runs Occurs whenever an order is created. Configuration includes only copy these tags.
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?)
shopify/orders/create
{% if event.preview %} {% capture order_json %} { "admin_graphql_api_id": "gid://shopify/Order/1234567890", "tags": "", "customer": { "tags": {{ options.only_copy_these_tags__array | join: ", " | default: "wholesale, approved" | json }} } } {% endcapture %} {% assign order = order_json | parse_json %} {% endif %} {% assign customer_tags = order.customer.tags | split: ", " %} {% assign order_tags = order.tags | split: ", " %} {% assign tags_to_add = array %} {% for tag in customer_tags %} {% if options.only_copy_these_tags__array == blank or options.only_copy_these_tags__array contains tag %} {% unless order_tags contains tag %} {% assign tags_to_add[tags_to_add.size] = tag %} {% endunless %} {% endif %} {% endfor %} {% if tags_to_add != empty %} {% action "shopify" %} mutation { tagsAdd( id: {{ order.admin_graphql_api_id | json }} tags: {{ tags_to_add | json }} ) { userErrors { field message } } } {% endaction %} {% endif %}