Tutorials

Super Tags Liquid mode reference

Liquid mode lets a Super Tags rule be written as code: you get the full Shopify object for each item, plus add_tag and remove_tag helpers, and the rule tags whatever your logic decides. It is included on Pro plans and above, and it is the right tool when the visual builder's conditions cannot express what you need: looping variants, arithmetic, or multi-branch logic. This is the complete reference with a full example library.

How Liquid rules work

Switch a rule's recipe from Builder to Liquid and write Shopify-flavoured Liquid against the item being processed. The rule runs once per item; every add_tag that executes applies that tag to the item. The editor gives you an inline linter (unbalanced tags, unknown tags, missing add_tag) and the same live preview as builder rules, so you can watch your code tag real items from your store before saving.

Super Tags Liquid mode editor with syntax highlighting, linter and live data panel
Liquid mode: syntax-highlighted editor, the inline linter's verdict, and the Liquid data panel showing the inspected item's real values.
{% if product.total_inventory > 0 %}
  {% add_tag 'in-stock' %}
{% endif %}

Depending on the rule type your code sees product, variant, order or customer, with the fields you would expect from Shopify: product.title, product.vendor, product.type, product.price, product.compare_at_price, product.total_inventory, product.status, product.tags, product.variants, order.total_price, order.financial_status, order.fulfillment_status, customer.number_of_orders, customer.amount_spent, customer.state, and more. The field explorer in the editor lists everything available for your store.

Supported tags and filters

Category Supported
Tagging add_tag, remove_tag
Control flow if / elsif / else, unless, case / when
Loops for, with break and continue
Variables assign, capture
Other comment, raw

Filters supported by the editor's live preview: downcase, upcase, capitalize, strip, append, prepend, default, size, first, last, join, plus, minus, times, divided_by, round, abs.

The dynamic tag pattern

The single most useful pattern: build a tag from the item's own data with capture, then add it.

{% capture brand_tag %}brand-{{ product.vendor | downcase }}{% endcapture %}
{% add_tag brand_tag %}

Every example below is available inside the editor as a starter template, so you can apply it with one click and adapt it.

Product examples

Inventory

Tag in-stock products:

{% if product.total_inventory > 0 %}
  {% add_tag 'in-stock' %}
{% endif %}

Flag low stock (1 to 5 units across variants):

{% if product.total_inventory > 0 and product.total_inventory < 6 %}
  {% add_tag 'low-stock' %}
{% endif %}

Tag sold-out products:

{% if product.total_inventory == 0 %}
  {% add_tag 'sold-out' %}
{% endif %}

Loop variants and tag each in-stock size - this is the classic example the builder cannot do:

{% for variant in product.variants %}
  {% if variant.inventory_quantity > 0 %}
    {% capture size_tag %}size-{{ variant.option1 | downcase }}{% endcapture %}
    {% add_tag size_tag %}
  {% endif %}
{% endfor %}

Pricing

Tag on-sale items by comparing two fields (another thing only Liquid can do):

{% if product.compare_at_price > product.price %}
  {% add_tag 'sale' %}
{% endif %}

Price banding:

{% if product.price >= 100 %}
  {% add_tag 'premium' %}
{% elsif product.price >= 30 %}
  {% add_tag 'mid-range' %}
{% else %}
  {% add_tag 'clearance' %}
{% endif %}

Merchandising

Tag by product type or vendor:

{% capture type_tag %}type-{{ product.type | downcase }}{% endcapture %}
{% add_tag type_tag %}

{% capture brand_tag %}brand-{{ product.vendor | downcase }}{% endcapture %}
{% add_tag brand_tag %}

Flag drafts for review:

{% if product.status == 'DRAFT' %}
  {% add_tag 'needs-review' %}
{% endif %}

Logic patterns

And, or, nesting and unless:

{% if product.status == 'ACTIVE' and product.total_inventory > 0 %}
  {% add_tag 'buyable' %}
{% endif %}

{% if product.type == 'Hoodies' or product.type == 'Jackets' %}
  {% add_tag 'outerwear' %}
{% endif %}

{% if product.status == 'ACTIVE' %}
  {% if product.total_inventory > 0 %}
    {% add_tag 'available' %}
  {% else %}
    {% add_tag 'coming-soon' %}
  {% endif %}
{% endif %}

{% unless product.total_inventory > 0 %}
  {% add_tag 'out-of-stock' %}
{% endunless %}

Variant rule examples

Variant rules run once per variant and tag the parent product (variants are not natively taggable in Shopify).

{% if variant.inventory_quantity > 0 and variant.inventory_quantity < 5 %}
  {% add_tag 'low-stock' %}
{% endif %}

{% if variant.compare_at_price > variant.price %}
  {% add_tag 'sale' %}
{% endif %}

{% if variant.price >= 100 %}
  {% add_tag 'premium' %}
{% else %}
  {% add_tag 'standard' %}
{% endif %}

Order rule examples

{% if order.financial_status == 'PAID' and order.fulfillment_status == 'UNFULFILLED' %}
  {% add_tag 'ready-to-ship' %}
{% endif %}

{% if order.total_price >= 200 or order.tags contains 'vip' %}
  {% add_tag 'high-priority' %}
{% endif %}

{% if order.financial_status == 'PAID' %}
  {% if order.total_price >= 200 %}
    {% add_tag 'paid-high-value' %}
  {% else %}
    {% add_tag 'paid' %}
  {% endif %}
{% endif %}

{% unless order.fulfillment_status == 'FULFILLED' %}
  {% add_tag 'open' %}
{% endunless %}

Customer rule examples

Spend tiers are the canonical customer example - one rule, three tiers:

{% if customer.amount_spent >= 5000 %}
  {% add_tag 'tier-gold' %}
{% elsif customer.amount_spent >= 1000 %}
  {% add_tag 'tier-silver' %}
{% else %}
  {% add_tag 'tier-bronze' %}
{% endif %}
{% if customer.number_of_orders > 10 %}
  {% add_tag 'loyal' %}
{% endif %}

{% if customer.number_of_orders <= 1 %}
  {% add_tag 'new-customer' %}
{% endif %}

{% if customer.amount_spent >= 5000 or customer.number_of_orders >= 20 %}
  {% add_tag 'top-customer' %}
{% endif %}

Removing tags with remove_tag

Rules normally untag automatically when an item stops matching, but remove_tag lets one rule actively clean up as it goes, for example retiring an old tag scheme while applying the new one:

{% if product.total_inventory > 0 %}
  {% add_tag 'in-stock' %}
  {% remove_tag 'sold-out' %}
{% endif %}

Official Shopify Liquid resources

Super Tags Liquid is standard Shopify Liquid plus the tagging helpers, so Shopify's official documentation is the perfect companion reference:

Related tutorials