Mechanic is a development platform for Shopify. :)
This task automatically adds the tag of your choice to incoming orders, based on the country in the order's shipping address.
Runs when an order is created. Configuration includes country code and tag to apply.
This task automatically adds the tag of your choice to incoming orders, based on the country in the order's shipping address.
This task automatically tags orders based on the country in the shipping address. The "Country code" option expects the two-character country code in all caps. Find country codes here.
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.
{% if event.preview %} {% assign order = '{"admin_graphql_api_id": "gid://shopify/Order/1234567890"}' | parse_json %} {% assign order["shipping_address"] = hash %} {% assign order["shipping_address"]["country_code"] = options.country_code__required %} {% endif %} {% if order.shipping_address.country_code == options.country_code__required %} {% action "shopify" %} mutation { tagsAdd( id: {{ order.admin_graphql_api_id | json }} tags: {{ options.tag_to_apply__required | json }} ) { userErrors { field message } } } {% endaction %} {% endif %}