Comparison Operators
Liquid supports standard comparisons inside {% if %}, {% unless %}, and {% case %} tags. Operands can be variables, object properties, or literals.
- == equal · != not equal
- < less than · > greater than · <= · >=
- contains — checks if a string includes a substring, or an array includes an item
- and · or — combine multiple conditions
Working with Money and Tags
Product prices in Liquid are integers in the store's smallest currency unit (cents for USD). Compare numeric prices directly. For product tags, use contains — tags are an array of strings assigned in Shopify Admin.
Price thresholds and tag-based badges
{% if product.price < 5000 and product.available %}
<span class="badge badge--budget">Under $50</span>
{% endif %}
{% if product.tags contains 'bestseller' %}
<span class="badge badge--bestseller">Bestseller</span>
{% endif %}
{% if product.tags contains 'sale' or product.compare_at_price > product.price %}
<span class="badge badge--sale">On sale</span>
{% endif %}The contains operator is case-sensitive for tags. Normalize tags in Admin (lowercase, hyphenated) to avoid mismatches like 'Sale' vs 'sale'.
Note: Never compare money formatted strings (| money output). Always compare raw integer prices from product.price or variant.price.