Auto-tag orders created from drafts with Mechanic.

Mechanic is the one-tool-does-it-all automation app for Shopify. :)

Auto-tag orders created from drafts

by Isaac Bowen (team@usemechanic.com)

This task monitors for newly-created orders, and auto-tags any that were originally based on a Shopify draft order, using the tag of your choice.

Runs when an order is created. Configuration includes tag to add.

15-day free trial – unlimited tasks

Documentation

This task monitors for newly-created orders, and auto-tags any that were originally based on a Shopify draft order, using the tag of your choice.

Developer details

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.

Events
when an order is created (shopify/orders/create)
Options
tag to add (required)
Script
{% if event.preview or order.source_name == "shopify_draft_order" %}
  {% action "shopify" %}
    mutation {
      tagsAdd(
        id: {{ order.admin_graphql_api_id | default: "gid://shopify/Order/1234567890" | json }}
        tags: {{ options.tag_to_add__required | json }}
      ) {
        userErrors {
          field
          message
        }
      }
    }
  {% endaction %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Tag to add
from-draft