Auto-tag new draft orders
Immediately upon the creation of a draft order, add one or more tags. Simple as that. :)
Try this taskWhen it runs
Occurs whenever a draft order is created
What you choose
Draft order tags to add
Task code and subscriptions
You can edit the Liquid code after installing this task. View on GitHub or ask a question in the Mechanic Slack community.
Subscriptions
shopify/draft_orders/create
How task subscriptions work
Option types and flags
- Draft order tags to add (array, required)
Task code
{% if event.preview %}
{% assign draft_order = hash %}
{% assign draft_order["admin_graphql_api_id"] = "gid://shopify/DraftOrder/1234567890" %}
{% endif %}
{% action "shopify" %}
mutation {
tagsAdd(
id: {{ draft_order.admin_graphql_api_id | json }}
tags: {{ options.draft_order_tags_to_add__array_required | json }}
) {
userErrors {
field
message
}
}
}
{% endaction %}
Mechanic Liquid reference