Storefronts
The following are logical and comparison operators used within conditional tags.
| Operator | Description |
| == | equals |
| != | does not equal |
| > | greater than |
| < | less than |
| >= | greater than or equal to |
| <= | less than or equal to |
| or | matches condition A or B |
| and | matches condition A and B |
| contains | matches substrings or strings in arrays |
Numerical operators such as + and - are not supported. Instead, you would use the mathematical filters such as {{ a | plus: b }} and {{ a | plus: b }}. See the Math filter section for more details.
Tags are surrounded by {% ... %} delimiters and are always closed with a matching end tag.
{% if account %}
Hello, {{ account.name }}
{% endif %}Filters are used to modify output or assignment of a variable, separate by a pipe | character. They can take one or more positional or named arguments.
{{ product.price | money }}Liquid templates are formatted for readability, however it can affect the HTML output in undesirable ways. Use a hyphen - character on either or both sides of any tag to cause Liquid to strip whitespace on the left and right sides of the tag.
{%- if category.products.size > 0 -%}
...
{%- endif -%}Also note, each tag outputs a trailing newline \n character, however adding a hyphen to the end of the tag will strip the newline from output.
{% assign author = "emmett" -%}
{{ author }}The following are supported conditional tags for output control.
| Tag | Description |
| if | render output if conditions match |
| elseif | alternate `if` expression |
| else | render output if no previous conditions match |
| unless | render output if conditions do not match |
| case | switch output between one or more `when` tags |
See the Conditional tags section for more details.
The following are tags used to iterate through array and collection values.
| Tag | Description |
| for | renders output for every item of an array |
| else | alternate output when `for` has zero length |
| break | stops a `for` loop from iterating |
| continue | causes a `for` loop to skip to the next iteration |
| cycle | renders an output from a list of strings for each `for` loop iteration |
| tablerow | render HTML ` |
| tags for each item in an array | |
| paginate | iterates through a collection across multiple pages |
See the Iteration tags section for more details.
The following are tags to control how Liquid is processed and rendered.
| Tag | Description |
| comment | prevents an expression from being rendered |
| echo | outputs an expression, usable inside `{% liquid %}` tags |
| liquid | a block of Liquid code without individual delimiters |
| raw | ouputs any Liquid code without rendering it |
See the Syntax tags section for more details.
| Tag | Description |
| assign | creates or overwrites a variable with the assigned value |
| capture | capture a variable value as the expression output |
| decrement | decreases the value of a numeric variable by 1 |
| increment | increases the value of a numeric variable by 1 |
See the Variable tags section for more details.