Mechanic Get Mechanic
Task library

Auto-tag new draft orders

Immediately upon the creation of a draft order, add one or more tags. Simple as that. :)

Try this task

When 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

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