Auto-tag new orders based on payment method, with Mechanic.

Mechanic is an automation development platform for Shopify. :)

Auto-tag new orders based on payment method

by Isaac Bowen (

This task checks the payment method for new orders immediately upon order creation, and tags the order accordingly. (If you need to tag the order later on, based on updates or when the order is paid, get in touch!)

Runs when an order is created. Configuration includes payment gateway name and comma separated tags to add.

15-day free trial – unlimited tasks

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.

when an order is created (shopify/orders/create)
payment gateway name (required), comma separated tags to add (required)
{% assign order_qualifies = false %}
{% if order.payment_gateway_names contains options.payment_gateway_name__required %}
  {% assign order_qualifies = true %}
{% endif %}

{% if event.preview or order_qualifies %}
    "action": {
      "type": "shopify",
      "options": [
          {{ }}
          "tags": {{ order.tags | add_tags: options.comma_separated_tags_to_add__required | json }}
{% endif %}

{% if event.preview != true and order_qualifies != true %}
  {% capture log_message %}
    The order did not qualify for auto-tagging. This task is configured to look for {{ options.payment_gateway_name__required | json }}; this order was paid using {{ order.payment_gateway_names | json }}.
  {% endcapture %}

  { "log": {{ log_message | strip | json }} }
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.