Theme code reference
This page lists everything a theme code template can read and use. It matches the engine’s own catalog, which also produces the AGENTS.md file that repzo store pull writes and the guide you get from repzo store code guide SITE_ID or GET /api/v1/commerce/sites/{siteId}/code/guide.
Templates only read data. Text is already in the page’s language. Prices are decimal amounts, so format them with | money.
Objects
Section titled “Objects”section
Section titled “section”The section being drawn (section files and the blocks inside them).
| Property | Description |
|---|---|
section.id |
The section’s id in the page (unique). |
section.type |
The file name (“hero-banner”). |
section.settings |
Its settings by id, from the {% schema %}. Text is already in the page’s language. |
section.blocks |
Its visible blocks in order. |
section.index |
Position on the page (1-based); index0 is 0-based. |
section.location |
header, template or footer. |
section.sf_attributes |
data-sf-id attribute so the builder can select the section (also shopify_attributes). |
<h2>{{ section.settings.heading }}</h2>A block: inside {% for block in section.blocks %}, or the block a blocks/*.liquid file draws.
| Property | Description |
|---|---|
block.id |
The block’s id. |
block.type |
Its type as written in the schema (“slide”, the block file’s name, or a builder block’s type such as “heading”). |
block.builder |
true for a builder block (heading, button, product card, group…): {% render_block block %} / {% content_for 'blocks' %} place it, the store draws it. |
block.settings |
Its settings by id. |
block.blocks |
Its own blocks (block files that take blocks). |
block.index |
Position among its siblings (1-based); index0 is 0-based. |
block.sf_attributes |
data-sf-id attribute: put it on the block’s outer element so the builder can select it (also shopify_attributes). Block files get a wrapper with it automatically. |
<div class="slide" {{ block.sf_attributes }}>{{ block.settings.title }}</div>product
Section titled “product”The product a product page shows (nil elsewhere). Product settings give the same object.
| Property | Description |
|---|---|
product.id |
The product’s id. |
product.title |
Name, in the store’s language. |
product.handle |
URL handle. |
product.url |
Link to the product page (with the language prefix). |
product.price |
Price as a decimal amount in the store currency (format with | money). |
product.price_min |
Lowest variant price. |
product.price_max |
Highest variant price. |
product.price_varies |
true when variants have different prices. |
product.compare_at_price |
Price before the discount, or nil. |
product.on_sale |
true when compare_at_price is above price. |
product.available |
true when it can be bought. |
product.vendor |
Brand / vendor. |
product.sku |
SKU. |
product.tags |
List of tags. |
product.description |
Description HTML. |
product.short_description |
Short plain-text description. |
product.featured_image |
Main image (image object: url, alt). |
product.images |
List of image objects. |
product.media |
List of media: media_type (image | video), url, alt, preview_image. |
product.options |
Option names (“Size”, “Color”). |
product.options_with_values |
Options: name, position, values. |
product.variants |
Variants: id, title, price, compare_at_price, available, sku, options, option1-3, image, url, inventory_quantity. |
product.first_available_variant |
The first variant in stock. |
product.has_only_default_variant |
true for products without options. |
product.rating |
Review rating (value, count) or nil. |
{{ product.title }} — {{ product.price | money }}collection
Section titled “collection”The collection a collection page shows (nil elsewhere). Collection settings give the same object.
| Property | Description |
|---|---|
collection.id |
The collection’s id. |
collection.title |
Name. |
collection.handle |
URL handle. |
collection.url |
Link to the collection page. |
collection.description |
Description HTML. |
collection.image |
Image object or nil. |
collection.products |
Its first 24 products (product objects), or inside {% paginate collection.products by N %} the page ?page= asks for. Empty for collections from a collection_list setting. |
collection.products_count |
How many products it has. |
{% for product in collection.products limit: 8 %}{% render 'product-card', product: product %}{% endfor %}article
Section titled “article”The blog post a post page shows (nil elsewhere). Blog settings list posts as article objects.
| Property | Description |
|---|---|
article.title |
Title. |
article.handle |
URL handle. |
article.url |
Link to the post. |
article.excerpt |
Short summary. |
article.content |
Body HTML (post pages). |
article.image |
Image object or nil. |
article.published_at |
ISO date (format with | date). |
article.reading_minutes |
Estimated reading time. |
article.blog |
Its blog: title, handle, url. |
<h1>{{ article.title }}</h1>{{ article.content }}The content entry a content template page shows (nil elsewhere): its fields by key.
| Property | Description |
|---|---|
entry.handle |
URL handle. |
entry.type |
Content type key. |
entry.fields |
Field values by key (also readable directly: entry.<key>). |
<h1>{{ entry.name }}</h1>The store (also available as shop).
| Property | Description |
|---|---|
site.name |
Store name. |
site.currency |
Currency code (“SAR”). |
site.locale |
The page’s language. |
site.default_locale |
The store’s main language. |
site.locales |
The store’s languages. |
site.url |
Home link. |
© {{ 'now' | date: '%Y' }} {{ site.name }}settings
Section titled “settings”The theme settings (Theme settings in the builder): colors, fonts, logo, social links… Text in the page’s language.
| Property | Description |
|---|---|
settings.<id> |
Any theme setting by id (see config/settings.json). |
{% if settings.logo %}{{ settings.logo | image_tag: alt: site.name }}{% endif %}Navigation menus by handle (also available as linklists). Link list settings give a menu object.
| Property | Description |
|---|---|
menus.<handle>.title |
The menu’s name. |
menus.<handle>.links |
Links: title, url, active, current, image, links (children, up to 3 levels). |
{% for link in menus['main-menu'].links %}<a href="{{ link.url }}">{{ link.title }}</a>{% endfor %}request
Section titled “request”The page request.
| Property | Description |
|---|---|
request.locale |
Language code (en, ar). |
request.direction |
ltr or rtl. |
request.rtl |
true on right-to-left pages. |
request.page_type |
Kind of page: home, product, collection, cart, search, page, blog, article… |
request.path |
Path without the language prefix. |
request.path_prefix |
“” or “/ar” — put it before your own links. |
request.design_mode |
true inside the builder. |
<div dir="{{ request.direction }}" lang="{{ request.locale }}">routes
Section titled “routes”Store links with the language prefix.
| Property | Description |
|---|---|
routes.root_url |
Home. |
routes.cart_url |
Cart page. |
routes.search_url |
Search page. |
routes.collections_url |
Collections list. |
routes.all_products_collection_url |
Every product. |
routes.account_url |
Shopper account. |
<a href="{{ routes.cart_url }}">Cart</a>Always empty on the drawn page (pages are cached for every shopper). Show the live cart with data-sf-cart=“count” / “total”.
| Property | Description |
|---|---|
cart.item_count |
0 when drawn; data-sf-cart fills the real value in the browser. |
cart.total_price |
0 when drawn. |
cart.items |
Empty when drawn. |
<span data-sf-cart="count">0</span>template
Section titled “template”The page’s template.
| Property | Description |
|---|---|
template.name |
Same as request.page_type. |
{% if template.name == 'product' %}…{% endif %}search
Section titled “search”The search page’s query and results (24 per page; paginate with {% paginate search.results by 24 %}). Empty on other pages.
| Property | Description |
|---|---|
search.performed |
true when the shopper searched. |
search.terms |
What they searched for. |
search.results |
The page’s results (product objects). |
search.results_count |
How many results in all. |
{% if search.performed %}{{ search.results_count }} results for {{ search.terms | escape }}{% endif %}paginate
Section titled “paginate”Inside {% paginate list by N %}: the pages of the list (links keep the page’s other query values).
| Property | Description |
|---|---|
paginate.current_page |
The page shown (from ?page=). |
paginate.pages |
How many pages. |
paginate.items |
How many items in all. |
paginate.page_size |
Items per page. |
paginate.current_offset |
Items before this page. |
paginate.previous |
{ title, url, is_link } or nil on the first page. |
paginate.next |
{ title, url, is_link } or nil on the last page. |
paginate.parts |
Page links for a custom pager: { title, url, is_link } (“…” gaps are not links). |
{% paginate collection.products by 12 %}…{{ paginate | default_pagination }}{% endpaginate %}Inside {% form %}: the form. It is always fresh when drawn (pages are cached for every shopper); after sending, the store shows the form’s [data-sf-form-success] or [data-sf-form-error] parts.
| Property | Description |
|---|---|
form.type |
contact, newsletter or product. |
form.id |
The form element’s id. |
form.errors |
Always empty when drawn (errors show in [data-sf-form-error]). |
form.posted_successfully? |
Always false when drawn (success shows [data-sf-form-success]). |
form.product_id |
Product forms: the product. |
{% form 'newsletter' %}<input type="email" name="email" required><button>Join</button><p data-sf-form-success>Thanks!</p>{% endform %}Filters
Section titled “Filters”An unknown filter is an error, so a typo never fails silently. Standard Liquid filters are available too; the table names the common ones.
| Filter | What it does | Example |
|---|---|---|
{{ amount | money }} |
A price in the store’s currency format. | {{ product.price | money }} |
{{ amount | money_with_currency }} |
A price with the currency code. | {{ product.price | money_with_currency }} |
{{ amount | money_without_currency }} |
The amount with two decimals, no symbol. | {{ product.price | money_without_currency }} |
{{ amount | money_without_trailing_zeros }} |
A price without .00. | {{ product.price | money_without_trailing_zeros }} |
{{ image | image_url: width: 800 }} |
An image’s URL (image object or URL; width is accepted for Shopify habits). | <img src="{{ section.settings.image | image_url }}" alt=""> |
{{ image | img_url }} |
Same as image_url. | {{ product.featured_image | img_url }} |
{{ image | image_tag: alt: 'Text', class: 'cover', loading: 'eager' }} |
An <img> tag (lazy by default; the image’s alt unless given). | {{ product.featured_image | image_tag: class: 'card__image' }} |
{{ 'key' | t }} or {{ 'Text' | t: ar: 'نص' }} |
A built-in store word by key (add_to_cart, sold_out, view_all… — the merchant’s overrides apply), or your own text with its Arabic. | <button>{{ 'add_to_cart' | t }}</button> {{ 'New in' | t: ar: 'وصل حديثاً' }} |
{{ text | handleize }} |
Text as a URL handle (“Summer Sale” → summer-sale); also handle. | {{ block.settings.title | handleize }} |
{{ text | handle }} |
Same as handleize. | {{ product.title | handle }} |
{{ text | link_to: url }} |
An <a> link (site paths, https, mailto and tel only). | {{ 'All products' | link_to: routes.all_products_collection_url }} |
{{ paginate | default_pagination }} |
Previous / page numbers / next links for {% paginate %} (in the page’s language; nothing when there’s one page). Class names: pagination, prev, page, current, deco, next. |
{% paginate collection.products by 12 %}…{{ paginate | default_pagination: previous: '‹', next: '›' }}{% endpaginate %} |
{{ count | pluralize: 'item', 'items' }} |
The singular or plural word. | {{ collection.products_count }} {{ collection.products_count | pluralize: 'product', 'products' }} |
{{ date | date: '%b %d, %Y' }} |
Format a date (strftime); ‘now’ is the current time. | {{ article.published_at | date: '%d %B %Y' }} |
{{ text | escape }} |
HTML-escape text (values aren’t escaped automatically; the output is sanitized anyway). | <p>{{ block.settings.quote | escape }}</p> |
{{ value | json }} |
A value as JSON. | {{ product.options | json }} |
{{ value | default: 'fallback' }} |
A fallback for nil / empty. | {{ section.settings.heading | default: site.name }} |
{{ html | strip_html }} |
Text without tags. | {{ product.description | strip_html | truncate: 120 }} |
{{ text | truncate: 80 }} |
Cut text to a length with … | {{ article.excerpt | truncate: 140 }} |
{{ text | newline_to_br }} |
Line breaks as <br>. | {{ section.settings.address | newline_to_br }} |
{{ text | upcase }} |
Upper case (also downcase, capitalize). | {{ product.vendor | upcase }} |
{{ number | plus: 1 }} |
Arithmetic (also minus, times, divided_by, modulo, round, ceil, floor, at_least, at_most). | {{ forloop.index | plus: 1 }} |
{{ text | split: ',' }} |
Text into a list (also join, first, last, size, map, where, sort, uniq, reverse, slice, concat). | {% assign tags = product.tags | join: ', ' %} |
{{ text | replace: 'a', 'b' }} |
Replace text (also append, prepend, remove, strip, url_encode). | {{ product.title | replace: '-', ' ' }} |
content_for, render_block, paginate, and form are Repzo tags. The rest are standard Liquid.
| Tag | What it does | Example |
|---|---|---|
{% if condition %}…{% elsif other %}…{% else %}…{% endif %} |
Conditions (also unless, case / when). | {% if product.on_sale %}<span class="badge">{{ 'sale' | t }}</span>{% endif %} |
{% unless condition %}…{% endunless %} |
The opposite of if. | {% unless product.available %}{{ 'sold_out' | t }}{% endunless %} |
{% case value %}{% when 'a' %}…{% else %}…{% endcase %} |
Choose by value (draw inline blocks by block.type). | {% case block.type %}{% when 'slide' %}…{% when 'quote' %}…{% endcase %} |
{% for item in list limit: 4 offset: 0 %}…{% else %}…{% endfor %} |
Loop (forloop.index, forloop.first, forloop.last; break / continue). | {% for block in section.blocks %}{% render_block block %}{% endfor %} |
{% assign name = value %} |
Set a variable. | {% assign hero = section.settings.image %} |
{% capture name %}…{% endcapture %} |
Set a variable to drawn text. | {% capture title %}{{ product.title }} – {{ site.name }}{% endcapture %} |
{% render 'snippet-name', product: product %} |
Draw snippets/<name>.liquid with the variables you pass (it can’t see the caller’s other variables). | {% render 'product-card', product: product, show_vendor: true %} |
{% content_for 'blocks' %} |
Draw the section’s (or block file’s) blocks in order: block files with their own templates, builder blocks (heading, button, product card, group…) as the store draws them. | <div class="grid">{% content_for 'blocks' %}</div> |
{% render_block block %} |
Draw one block — a blocks/*.liquid file or a builder block (in a loop over section.blocks). | {% for block in section.blocks %}<div class="cell">{% render_block block %}</div>{% endfor %} |
{% paginate collection.products by 12 %}…{% endpaginate %} |
Show a list a page at a time (?page= in the URL): collection.products (collection pages), section.settings.<collection>.products, search.results. Inside, the list holds that page and paginate describes the pages. Up to 48 per page. |
{% paginate collection.products by 12 %}{% for product in collection.products %}{% render 'product-card', product: product %}{% endfor %}{{ paginate | default_pagination }}{% endpaginate %} |
{% form 'contact' %} / {% form 'newsletter' %} / {% form 'product', product %} … {% endform %} |
A form we write and the store sends (themes can’t write <form>): contact (fields email, name, phone, message — or contact[email]… — plus any other named fields), newsletter (email), product (adds to cart: name=“variant_id” for the variant — defaults to the first available — and name=“quantity”). Options: class, id. Mark [data-sf-form-success] / [data-sf-form-error] parts. | {% form 'product', product, class: 'buy' %}<select name="variant_id">{% for variant in product.variants %}<option value="{{ variant.id }}">{{ variant.title }}</option>{% endfor %}</select><input type="number" name="quantity" value="1" min="1"><button type="submit">{{ 'add_to_cart' | t }}</button><p data-sf-form-error></p>{% endform %} |
{% schema %}{ "name": …, "settings": [ … ] }{% endschema %} |
The section’s / block’s settings, blocks and presets as JSON (one per file; snippets have none). | {% schema %}{ "name": "Banner", "settings": [{ "type": "text", "id": "heading", "label": "Heading" }], "presets": [{ "name": "Banner" }] }{% endschema %} |
{% stylesheet %}…{% endstylesheet %} |
CSS for this section / block, scoped to it (theme variables –sf-* available). | {% stylesheet %}.banner { padding: 4rem 1.5rem; background: var(--sf-bg); }{% endstylesheet %} |
{% comment %}…{% endcomment %} |
Notes that aren’t drawn (also {% # note %}). |
{% comment %} Hero image {% endcomment %} |
{% raw %}{{ not liquid }}{% endraw %} |
Text drawn as written. | {% raw %}{{ name }}{% endraw %} |
{% liquid assign a = 1 echo a %} |
Several tags in one block, one per line (echo prints). | {% liquid assign title = section.settings.heading echo title %} |
{% echo value %} |
Print a value (inside {% liquid %}). |
{% echo product.title %} |
{% cycle 'odd', 'even' %} |
Alternate values in a loop. | <li class="{% cycle 'a', 'b' %}"> |
{% tablerow item in list cols: 3 %}…{% endtablerow %} |
Table rows. | {% tablerow product in collection.products cols: 2 %}{{ product.title }}{% endtablerow %} |
{% increment counter %} |
Counters (also decrement). | {% increment n %} |
Tags that aren’t available
Section titled “Tags that aren’t available”These tags are refused with a message that says what to use instead:
| Tag | Use instead |
|---|---|
{% include %} |
{% render 'snippet-name' %} with snippets/snippet-name.liquid |
{% layout %} |
Nothing: the store draws the page around your sections |
{% block %} |
{% content_for 'blocks' %} or {% render_block block %} |
{% javascript %} |
The data-sf-* ready-made behaviours |
{% section %} |
Add sections in the builder or in templates/*.json |
{% sections %} |
Nothing: the store draws the header and footer groups |