Zone tags
Tags build a template's logic: conditions, loops, variables, snippet calls and theme tags.
This page is not hand-written: it is generated from the Zone engine's registry. Every name listed here actually works in the engine.
Summaries come straight from the source specification. Some summaries, syntax and examples are generated from MIT-licensed open specification data. Third-party licence notice
assign
Creates a new variable.
{% assign variable_name = value %}{%- assign product_title = product.title | upcase -%}
{{ product_title }}break
Stops a `for` loop from iterating.
{% break %}{% for i in (1..5) -%}
{%- if i == 4 -%}
{% break %}
{%- else -%}
{{ i }}
{%- endif -%}
{%- endfor %}capture
Creates a new variable with a string value.
{% capture variable %}
value
{% endcapture %}{%- assign up_title = product.title | upcase -%}
{%- assign down_title = product.title | downcase -%}
{%- assign show_up_title = true -%}
{%- capture title -%}
{% if show_up_title -%}
Upcase title: {{ up_title }}
{%- else -%}
Downcase title: {{ down_title }}
{%- endif %}
{%- endcapture %}
{{ title }}case
Renders a specific expression depending on the value of a specific variable.
{% case variable %}
{% when first_value %}
first_expression
{% when second_value %}
second_expression
{% else %}
third_expression
{% endcase %}{% case product.type %}
{% when 'Health' %}
This is a health potion.
{% when 'Love' %}
This is a love potion.
{% else %}
This is a potion.
{% endcase %}{% case product.type %}
{% when 'Love' or 'Luck' %}
This is a love or luck potion.
{% when 'Strength','Health' %}
This is a strength or health potion.
{% else %}
This is a potion.
{% endcase %}comment
Prevents an expression from being rendered or output.
{% comment %}
content
{% endcomment %}{% # this is a comment %}
{% # for i in (1..3) -%}
{{ i }}
{% # endfor %}
{%
###############################
# This is a comment
# across multiple lines
###############################
%}{% liquid
# this is a comment
assign topic = 'Learning about comments!'
echo topic
%}content_for
Creates a designated area in your theme where blocks can be rendered.
{% content_for 'blocks' %}
{% content_for 'block', type: "slide", id: "slide-1" %}{% content_for "blocks" %}{% content_for "block", type: "button", id: "static-block-1", color: "red" %}continue
Causes a `for` loop to skip to the next iteration.
{% continue %}{% for i in (1..5) -%}
{%- if i == 4 -%}
{% continue %}
{%- else -%}
{{ i }}
{%- endif -%}
{%- endfor %}cycle
Loops through a group of strings and outputs them one at a time for each iteration of a `for` loop.
{% cycle string, string, ... %}{% for i in (1..4) -%}
{% cycle 'one', 'two', 'three' %}
{%- endfor %}<!-- Iteration 1 -->
{% for i in (1..4) -%}
{% cycle 'one', 'two', 'three' %}
{%- endfor %}
<!-- Iteration 2 -->
{% for i in (1..4) -%}
{% cycle 'one', 'two', 'three' %}
{%- endfor %}
<!-- Iteration 3 -->
{% for i in (1..4) -%}
{% cycle 'group_1': 'one', 'two', 'three' %}
{%- endfor %}
<!-- Iteration 4 -->
{% for i in (1..4) -%}
{% cycle 'group_2': 'one', 'two', 'three' %}
{%- endfor %}decrement
Creates a new variable, with a default value of -1, that's decreased by 1 with each subsequent call. > Caution: > Predefined Liquid objects can be overridden by variables with the same name. > To make sure that you can access all Liquid objects, make sure that your variable name doesn't match a predefined object's name.
{% decrement variable_name %}{% decrement variable %}
{% decrement variable %}
{% decrement variable %}doc
Documents template elements with annotations.
{% doc %}
Renders a message.
@param {string} foo - A string value.
@param {string} [bar] - An optional string value.
@example
{% render 'message', foo: 'Hello', bar: 'World' %}
{% enddoc %}echo
Outputs an expression.
{% liquid
echo expression
%}{% echo product.title %}
{% liquid
echo product.price | money
%}else
Allows you to specify a default expression to execute when no other condition is met.
{% else %}
expression{% if product.available %}
This product is available!
{% else %}
This product is sold out!
{% endif %}else
Allows you to specify a default expression to execute when a `for` loop has zero length.
{% for variable in array %}
first_expression
{% else %}
second_expression
{% endfor %}{% for product in collection.products %}
{{ product.title }}<br>
{% else %}
There are no products in this collection.
{% endfor %}for
Renders an expression for every item in an array.
{% for variable in array %}
expression
{% endfor %}| Parameters | Type | Required | Description |
|---|---|---|---|
limit | number | No | The number of iterations to perform. |
offset | number | No | The 1-based index to start iterating at. |
range | untyped | No | A custom numeric range to iterate over. |
reversed | untyped | No | Iterate in reverse order. |
{% for product in collection.products -%}
{{ product.title }}
{%- endfor %}{% for product in collection.products limit: 2 -%}
{{ product.title }}
{%- endfor %}form
Generates an HTML `<form>` tag, including any required `<input>` tags to submit the form to a specific endpoint.
{% form 'form_type' %}
content
{% endform %}| Parameters | Type | Required | Description |
|---|---|---|---|
return_to | string | No | The desired URL to redirect to when the form submits. |
{% form 'activate_customer_password' %}
<!-- form content -->
{% endform %}{% form 'cart', cart %}
<!-- form content -->
{% endform %}if
Renders an expression if a specific condition is `true`.
{% if condition %}
expression
{% endif %}{% if product.compare_at_price > product.price %}
This product is on sale!
{% endif %}{% if product.type == 'Love' %}
This is a love potion!
{% elsif product.type == 'Health' %}
This is a health potion!
{% endif %}includeDeprecated
Renders a snippet.
{% include 'filename' %}increment
Creates a new variable, with a default value of 0, that's increased by 1 with each subsequent call. > Caution: > Predefined Liquid objects can be overridden by variables with the same name. > To make sure that you can access all Liquid objects, make sure that your variable name doesn't match a predefined object's name.
{% increment variable_name %}{% increment variable %}
{% increment variable %}
{% increment variable %}javascript
JavaScript code included in section, block and snippet files.
{% javascript %}
javascript_code
{% endjavascript %}layout
Specify which layout to use.
{% layout name %}liquid
Allows you to have a block of Liquid without delimeters on each tag.
{% liquid
expression
%}{% liquid
# Show a message that's customized to the product type
assign product_type = product.type | downcase
assign message = ''
case product_type
when 'health'
assign message = 'This is a health potion!'
when 'love'
assign message = 'This is a love potion!'
else
assign message = 'This is a potion!'
endcase
echo message
%}paginate
Splits an array's items across multiple pages.
{% paginate array by page_size %}
{% for item in array %}
forloop_content
{% endfor %}
{% endpaginate %}| Parameters | Type | Required | Description |
|---|---|---|---|
window_size | string | No | The number of pages to display in the pagination. |
{% paginate collection.products by 5 %}
{% for product in collection.products -%}
{{ product.title }}
{%- endfor %}
{{- paginate | default_pagination }}
{% endpaginate %}{% paginate collection.products by 4 %}
{% for product in collection.products limit: 4 -%}
{{ product.title }}
{%- endfor %}
{% endpaginate -%}
<!-- Less performant method -->
{% for product in collection.products limit: 4 -%}
{{ product.title }}
{%- endfor -%}raw
Outputs any Liquid code as text instead of rendering it.
{% raw %}
expression
{% endraw %}{% raw %}
{{ 2 | plus: 2 }} equals 4.
{% endraw %}render
Renders a snippet or app block.
{% render 'filename' %}{% render 'filename' for array as item %}{% render 'filename', variable: value %}section
Renders a section.
{% section 'name' %}{% section 'header' %}sections
Renders a section group.
{% sections 'name' %}style
{% style %}
CSS_rules
{% endstyle %}{% style %}
.h1 {
color: {{ settings.colors_accent_1 }};
}
{% endstyle %}stylesheet
CSS styles included in section, block, and snippet files.
{% stylesheet %}
css_styles
{% endstylesheet %}tablerow
Generates HTML table rows for every item in an array.
{% tablerow variable in array %}
expression
{% endtablerow %}| Parameters | Type | Required | Description |
|---|---|---|---|
cols | number | No | The number of columns that the table should have. |
limit | number | No | The number of iterations to perform. |
offset | number | No | The 1-based index to start iterating at. |
range | untyped | No | A custom numeric range to iterate over. |
<table>
{% tablerow product in collection.products %}
{{ product.title }}
{% endtablerow %}
</table><table>
{% tablerow product in collection.products cols: 2 %}
{{ product.title }}
{% endtablerow %}
</table>unless
Renders an expression unless a specific condition is `true`.
{% unless condition %}
expression
{% endunless %}{% unless product.has_only_default_variant %}
// Variant selection functionality
{% endunless %}