A VersaCommerce theme is a set of Liquid, JSON and asset files in fixed folders. This page describes the folders, JSON templates, section groups, theme blocks, settings and locales.
Folders
| Folder | Content |
|---|---|
layout/ |
Layout files such as theme.liquid, which wrap every page. |
templates/ |
Page templates as .liquid or .json files, including alternate templates such as product.alternate.json. |
sections/ |
Sections (.liquid) and section groups (.json). |
blocks/ |
Theme blocks that can be reused across sections. |
snippets/ |
Snippets rendered with render. Older themes may use include/, which is still read as a fallback. |
assets/ |
CSS, JavaScript, images and fonts. |
config/ |
settings_schema.json (setting definitions) and settings_data.json (setting values). |
locales/ |
Translation files of the theme. |
account/ |
Templates of the customer account. |
checkout/ |
Templates of the checkout steps. |
email/ |
Email templates. |
lists/ |
Templates for storefront lists. |
order_exports/ |
Templates for order exports. |
Template types
A theme can provide templates for these pages:
index,product,collection(also collection-specific templates),list-collections,cart,page,blog,article,search,404password,password_restriction,revocationaccount/account,account/login,account/signup,account/order,account/addressescheckout/login,checkout/customer,checkout/shipping,checkout/payment,checkout/confirm,checkout/thankyoulists/<name>,email/<name>,order_exports/<name>- widget templates:
product-widget,collection-widget
Use the template object to find out which template renders the current page.
JSON templates
A JSON template lists the sections of a page and their order instead of containing markup. The sections object is keyed by section ID. Each entry has a type (the file name in sections/), settings and optionally blocks, block_order and disabled. The order array sets the order of the sections. Disabled entries and entries missing from order are not rendered.
{
"sections": {
"main": { "type": "main-product", "settings": {} },
"recommendations": {
"type": "product-recommendations",
"settings": { "heading": "You may also like" }
}
},
"order": ["main", "recommendations"]
}
Optional keys:
layoutselects another layout file.wrapperwraps all sections in an element:main,sectionordiv, with an optional ID, classes and attributes in selector syntax, for example"div#product-page.page-width[data-page]".
Sections of a JSON template get generated IDs of the form template--<id>__<section-key>. Each section is wrapped in an element with the ID shopify-section-<section-id> and the class shopify-section, for compatibility with existing themes.
Section groups
A section group is a JSON file in sections/ with the keys sections and order, like a JSON template. Layouts render groups with the sections tag, typically a header group and a footer group around the page content:
{% sections 'header-group' %}
{{ content_for_layout }}
{% sections 'footer-group' %}
Sections of a group get IDs of the form sections--<id>__<section-key>, and their wrappers get an extra CSS class for the group.
Section schema
The schema tag of a section supports these keys:
| Key | Purpose |
|---|---|
name |
Name of the section in the theme editor. |
tag |
HTML element of the section wrapper. |
class |
Extra CSS classes of the section wrapper. |
settings |
Section settings, each with id, type and optional default. |
blocks |
Block types the section accepts, with their own settings. |
presets |
Preconfigured versions shown when merchants add the section. |
enabled_on |
Templates (templates) or section groups (groups) where the section can be used. |
disabled_on |
Templates or section groups where the section cannot be used. |
Blocks
Sections can define their own blocks in the schema. A block has an ID, a type and typed settings; see the block object. In the theme editor, output {{ block.shopify_attributes }} on the block's outer element so that merchants can select the block.
Block instances can be disabled, can contain nested blocks and keep their order in block_order.
Theme blocks
Theme blocks are separate files in blocks/<type>.liquid with their own schema, settings and presets. Sections and other blocks render them with the content_for tag:
{% content_for 'blocks' %}renders the child blocks the merchant added.{% content_for 'block', type: 'heading', id: 'title' %}renders a static block.
Theme block wrappers use the class shopify-block. Set "tag": null in the block schema to render the block without a wrapper. Inside a theme block, the closest object gives access to the nearest product, collection, article, blog, page or metaobject.
Theme settings
config/settings_schema.json defines the global theme settings, and config/settings_data.json stores their values. Older themes can still use the legacy settings format. Access the values through the settings object. Defaults from the schema apply when no value is stored.
Section and block settings are resolved per instance and are available through section.settings and block.settings.
Setting types
Most setting types return a plain value (text, number, boolean). These types return objects:
| Type | Returns |
|---|---|
image_picker |
An image from the theme assets or the shop's media files |
collection |
A collection |
collection_list |
A list of collections |
product |
A product |
product_list |
A list of products |
page |
A page |
blog |
A blog |
article |
An article |
link_list |
A menu (linklist) |
url |
A URL object with path_parts, query, anchor and uri |
richtext, html, liquid |
The content, rendered as a string |
color |
A color |
color_scheme |
A color scheme of the theme with id and settings |
color_scheme_group |
All color schemes of the theme |
color_palette |
A palette of colors |
font_picker |
A font from the font library |
video_url |
A video URL object with type, id and uri |
video |
An uploaded video, found by file name |
text_file |
An uploaded document, found by file name |
range |
An integer |
Locales
Theme translations live in locales/<locale>.json. Use them with the t filter (alias translate); theme keys are looked up first, then the platform's default translations. Date formats for the date filter can be defined under date_formats in the theme locale.
Translations for the theme editor (schema labels with t: keys) live in locales/<locale>.schema.json.