Mechanic is a development and ecommerce automation platform for Shopify. :)
Activating this task will automatically keep the order tags up to date with the customer's tags.
Runs Occurs whenever a customer is updated.
Activating this task will automatically keep the order tags up to date with the customer's tags.
When a customer is updated, this task will go through each of that customer's past orders and add all of the customer's current tags as order tags (if any new tags are found).
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/customers/update
{% assign customer_tags = customer.tags | split: ", " %} {% if event.preview %} {% action "shopify" %} mutation { tagsAdd( id: "gid://shopify/Order/123456" tags: ["foo"] ) { userErrors { field message } } } {% endaction %} {% else %} {% for order in customer.orders.any %} {% assign order_tags = order.tags | split: ", " %} {% assign tags_to_add = array %} {% for tag in customer_tags %} {% unless order_tags contains tag %} {% assign tags_to_add[tags_to_add.size] = tag %} {% endunless %} {% 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 %} {% endfor %} {% endif %}