Quick reference
One-page lookup for the storefront template syntax. Every entry is a brace tag or token you can paste into a page template, reusable block, or system template. Each row gives the meaning and a short example.
| Tag | Meaning | Example |
|---|
{each <collection> as=<name>} ... {/each} | Repeat the block once per item. Accepts limit=<n> to cap the count, and an optional label on the closing tag. | {each nav_links as=link limit=4}{link.label}{/each} |
{if <condition>} ... {/if} | Show the block only when the condition is true. A bare value is true when it is not empty, 0, false, off, null, [], or {}. | {if currentUser.isLoggedIn}Welcome back{/if} |
{elseif <condition>} | Alternative branch, tested in order after {if} and before {else}. | {if brand.tagline}...{elseif brand.support_phone}...{/if} |
{else} | Fallback branch used when no earlier condition matched. | {if brand.tagline}{brand.tagline}{else}Add a tagline{/if} |
{if_skip <condition>} ... {/if_skip} | Deferred conditional: like {if}, but evaluated later, once values from an enclosing loop are in scope. | {if_skip brand.tagline}Has a tagline{/if_skip} |
{page_link id=<page_id>} | Outputs the URL of the page with that id. | <a href="{page_link id=10}">Cart</a> |
{block_ref id=<block_id>} | Embed a reusable block by its id. | {block_ref id=7} |
{block_ref code=<code>} | Embed a reusable block by its code. | {block_ref code=product_item} |
Condition operators
| Operator | Meaning | Example |
|---|
== | Equal. Text comparison ignores case. | {if field.type == "password"}...{/if} |
!= | Not equal. | {if brand.language != en}...{/if} |
> | Greater than. Numeric. | {if template.name.len() > 40}...{/if} |
< | Less than. Numeric. | {if template.name.len() < 3}...{/if} |
>= | Greater than or equal. Numeric. | {if template.version_num >= 2}...{/if} |
<= | Less than or equal. Numeric. | {if template.name.len() <= 40}...{/if} |
&& | Both sides must be true. | {if currentUser.isLoggedIn && brand.tagline}...{/if} |
|| | Either side must be true. | {if brand.media.desktop_light_logo || brand.media.desktop_dark_logo}...{/if} |
! | Negates the condition. | {if !currentUser.isLoggedIn}...{/if} |
Parentheses group operators, and a value with no operator is tested for truthiness.
Methods
| Method | Meaning | Example |
|---|
.len() | Length of the value as a number. No arguments. | {if template.name.len() > 40}...{/if} |
.is_empty() | True when the value has no content. No arguments. | {if brand.tagline.is_empty()}...{/if} |
.format_date("<pattern>") | Format a date value. Defaults to the pattern MMM D, YYYY. | {template.updated_at.format_date("D MMM YYYY")} |
.inline_json() | Serialize the value as compact JSON, safe inside a double-quoted HTML attribute. | <div data-schema="{page.schema.inline_json()}"> |
.letter(<count>[, <from>]) | Take a number of characters, one by default. Pass last as <from> to take them from the end. | {template.name.letter(3)} |
Common token families
| Family | Examples | Notes |
|---|
| Project variable | {{var.support_email}}, {{var.docs_link}} | Values created in the designer. See Variables and tokens. |
| Brand | {brand.store_name}, {brand.tagline} | Store name and tagline from brand settings. |
| Logo and media | {core.project.logo}, {core.project.logo.desktop_dark}, {core.project.media.favicon} | Configured asset URLs. A key with no asset renders empty, so wrap it in {if} with a fallback. |
| Storefront settings | {core.project.currency_symbol} | Currency symbol from project settings. |
| Page | {core.page.is_homepage}, {core.page.path} | Context for the page being rendered. |
| Query value | {core.project.get.<query_key>} | Reads a value from the current URL query string. |
| User | {currentUser.isLoggedIn}, {currentUser.firstName} | Signed-in user context. |
| Loop item | {link.label}, {template.name} | Field on the alias named in the enclosing {each} tag. |
Extension template tokens
Tags, loops, and tokens that an extension adds are documented with the extension that provides them:
See also