On this page
- What Was Hard in Vintage Themes, and What OS 2.0 Changed
- JSON Templates: Drag-and-Drop Sections on Every Page
- What Lives Inside a JSON Template
- How Shopify Renders the Page
- Theme Directory Layout: What Goes Where
- Building Configurable Modules with Schema and Blocks
- Common Schema Fields
- Complete Example: Feature Cards Section
- Dynamic Sources and Metaobjects: Less Hardcoded Logic
- Connecting Dynamic Sources
- Managing Grouped Content with Metaobjects
- Theme App Extensions: Installing Apps Without Polluting Code
- Code Quality and Speed: render, Theme Check, and Web Vitals
- Use {% render %} Instead of {% include %}
- Catch Mistakes Early with Theme Check
- Practical Speed Targets
- 7 Practical Best Practices for Daily Development
- 1. Use Section Groups for the Header and Footer Instead of Hardcoding Them
- 2. Include @app Block Support in Core Sections
- 3. Use the Section Rendering API for Partial UI Updates
- 4. Wrap Interactive Widgets in Web Components so Theme Editor Previews Stay Alive
- 5. Load Section CSS and JS on Demand Instead of One Giant Bundle
- 6. Treat Above-the-Fold Hero Images Differently from Lazy Images
- 7. Keep Schema Settings Focused Instead of Building a “Cockpit”
- Team Workflows: Avoiding Overwritten Merchant Settings
- Wrapping Up
- Further Reading
Developers new to Shopify often assume theme work is mostly looping over product lists in Liquid. In older Vintage themes, codebases did tend to grow that way—page layout, style switches, and business rules all piled into a few large template files, so changing one thing risked breaking another.
Online Store 2.0 (OS 2.0) separates page layout, reusable modules, product data, and third-party apps into distinct layers. Understanding OS 2.0 is less about memorizing new Liquid tags and more about seeing how those boundaries keep merchandising updates and code changes out of each other’s way.
What Was Hard in Vintage Themes, and What OS 2.0 Changed
Before OS 2.0, maintaining a theme for two or three years usually ran into three recurring problems:
- Only the homepage supported drag-and-drop sections: Dynamic sections were limited to
templates/index.liquid. Product pages, collection pages, and blog posts used fixed.liquidtemplates. If the store team wanted a promo banner or review block on certain product categories, developers either duplicated template files or filled the code with{% if product.tags contains 'xxx' %}checks. - Uninstalled apps left leftover code behind: Third-party apps for reviews, size charts, or subscriptions often edited
layout/theme.liquiddirectly or injected external script tags. When a merchant uninstalled an app, those snippets and scripts stayed in the theme files and slowed down page loads. - Settings and code lived in the same files: Layout structure, font sizes, colors, and hardcoded copy sat right next to template logic. A quick setting tweak in Admin and a code change on a developer’s machine could easily overwrite each other.
OS 2.0 addresses each of those pain points directly:
| Area | Vintage Themes | Online Store 2.0 Themes |
|---|---|---|
| Page templates | Monolithic .liquid files (e.g., product.liquid) | Configuration-only .json files (e.g., product.json) |
| Draggable sections | Homepage only | Sections Everywhere: add and reorder sections on any page |
| App integration | Direct edits to theme.liquid or injected script tags | Theme App Extensions: draggable blocks with no theme file edits |
| Data binding | Hardcoded copy or flat global metafields | Dynamic Sources paired with structured Metaobjects |
| Code snippets | Shared-scope {% include 'snippet' %} | Isolated-scope {% render 'snippet' %} |
In short, theme development shifted from hardcoding whole pages to building independent modules that merchants can arrange themselves.
JSON Templates: Drag-and-Drop Sections on Every Page
The most visible change in OS 2.0 is replacing .liquid page templates with .json files. On a product page, the old templates/product.liquid splits into two parts: templates/product.json records which sections appear on the page and in what order, while sections/main-product.liquid holds the actual HTML and Liquid markup.
What Lives Inside a JSON Template
A JSON template contains no HTML or conditional logic. It is a plain list of modules and settings built around two top-level fields:
sections: Every module instance used on the page, including which section file it points to (type), its savedsettings, and any nestedblocks.order: An array listing the top-to-bottom order in which those sections render.
Here is a typical templates/product.json:
{
"name": "Default Product",
"wrapper": "main",
"sections": {
"main": {
"type": "main-product",
"blocks": {
"title": {
"type": "title",
"settings": {}
},
"price": {
"type": "price",
"settings": {
"show_shipping_policy": true
}
},
"variant_picker": {
"type": "variant_picker",
"settings": {
"picker_type": "button"
}
},
"buy_buttons": {
"type": "buy_buttons",
"settings": {
"show_dynamic_checkout": true
}
}
},
"block_order": [
"title",
"price",
"variant_picker",
"buy_buttons"
],
"settings": {
"enable_sticky_info": true
}
},
"recommendations": {
"type": "product-recommendations",
"settings": {
"heading": "You May Also Like"
}
}
},
"order": [
"main",
"recommendations"
]
}
How Shopify Renders the Page
When a shopper opens a product page, Shopify reads product.json and walks through the order array:
- It finds
sections/main-product.liquidformainand renders the product details using thesettingsandblocksfrom the JSON file. - It then renders
sections/product-recommendations.liquidforrecommendations.
Because layout order and settings sit in JSON rather than Liquid, rearranging modules or editing headings in the Theme Editor only updates product.json. Developers can build a single sections/hero.liquid or sections/newsletter.liquid, and merchants can drop it onto the homepage, product pages, landing pages, or even the 404 page.
Theme Directory Layout: What Goes Where
OS 2.0 themes follow a fixed folder structure where each directory has one job:
theme-root/
├── assets/ # Compiled CSS, JS, fonts, and static images
├── config/ # Global Theme Editor form schema and saved merchant values
│ ├── settings_data.json
│ └── settings_schema.json
├── layout/ # Outer HTML document wrapper
│ ├── password.liquid
│ └── theme.liquid
├── locales/ # Translation JSON files for storefront copy
│ ├── en.default.json
│ └── zh-CN.json
├── sections/ # Reusable page modules (HTML/Liquid + bottom {% schema %})
│ ├── header.liquid
│ ├── hero-banner.liquid
│ └── main-product.liquid
├── snippets/ # Small reusable Liquid fragments (not shown in Theme Editor)
│ ├── icon-cart.liquid
│ └── price.liquid
└── templates/ # Page section lists and saved settings (JSON files)
├── 404.json
├── cart.json
├── collection.json
├── index.json
└── product.json
In day-to-day work, here is how those folders divide responsibilities:
layout/: The outer HTML shell, centered ontheme.liquid. It handles<head>tags, global CSS/JS references, and{{ content_for_layout }}—the slot where Shopify injects the rendered JSON template for each page.templates/: Defines which sections appear on each page type. Apart from rare non-HTML endpoints such asgift_card.liquidor custom XML feeds, templates should be.jsonfiles.sections/: Where most development happens. Each file is a self-contained module with HTML and Liquid at the top and a{% schema %}JSON block at the bottom defining its Theme Editor controls.snippets/: Small, shared pieces like icons, price formatting, and product cards. Always include them with{% render %}rather than the deprecated{% include %}.config/:settings_schema.jsondefines the controls under global Theme Settings (brand colors, typography, social links), whilesettings_data.jsonstores the values saved by the merchant.assets/andlocales/:assets/holds static files and build output from tools like Vite;locales/stores translated strings accessed via{{ 'general.breadcrumbs.home' | t }}.
Building Configurable Modules with Schema and Blocks
Writing a section is half frontend markup and half designing the {% schema %} block at the bottom. Shopify reads that JSON block to build the settings sidebar in the Theme Editor.
Common Schema Fields
name: The module name shown in the Theme Editor.tagandclass: The outer HTML tag Shopify wraps around the section (divby default, often set tosection) and its CSS class.settings: Controls that apply to the whole section, such as headings, background color, or vertical spacing.blocks: Repeatable child items inside the section. Merchants can add cards, delete items, or drag them into a new order, andmax_blockscaps how many they can add.presets: Default configurations. Only sections withpresetsappear in the Theme Editor’s “Add section” picker; sections without presets can only be referenced directly by a template.
Complete Example: Feature Cards Section
Below is a practical sections/feature-showcase.liquid module that lets merchants edit the heading, pick a background color, and add or reorder feature cards:
{%- comment -%}
Feature Showcase: works on any page, with addable and sortable feature cards
{%- endcomment -%}
<div class="py-12 md:py-20" style="background-color: {{ section.settings.bg_color }};">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
{%- if section.settings.title != blank -%}
<div class="text-center mb-10">
<h2 class="text-3xl font-extrabold tracking-tight text-gray-900 sm:text-4xl">
{{ section.settings.title | escape }}
</h2>
{%- if section.settings.subtitle != blank -%}
<p class="mt-3 max-w-2xl mx-auto text-xl text-gray-500 sm:mt-4">
{{ section.settings.subtitle | escape }}
</p>
{%- endif -%}
</div>
{%- endif -%}
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
{%- for block in section.blocks -%}
<div class="p-6 bg-white rounded-xl shadow-sm border border-gray-100 flex flex-col items-center text-center" {{ block.shopify_attributes }}>
{%- case block.type -%}
{%- when 'feature_card' -%}
{%- if block.settings.card_image != blank -%}
<div class="w-16 h-16 mb-4 overflow-hidden rounded-lg">
{{ block.settings.card_image | image_url: width: 128 | image_tag: loading: 'lazy', class: 'w-full h-full object-cover', alt: block.settings.card_title }}
</div>
{%- endif -%}
<h3 class="text-lg font-bold text-gray-900 mb-2">
{{ block.settings.card_title | default: 'Feature Title' | escape }}
</h3>
<div class="text-sm text-gray-600">
{{ block.settings.card_content }}
</div>
{%- endcase -%}
</div>
{%- endfor -%}
</div>
</div>
</div>
{% schema %}
{
"name": "Feature Showcase",
"tag": "section",
"class": "section-feature-showcase",
"settings": [
{
"type": "text",
"id": "title",
"label": "Heading",
"default": "Why Choose Our Products"
},
{
"type": "text",
"id": "subtitle",
"label": "Subtitle",
"default": "Carefully selected materials, reliable quality, and responsive support."
},
{
"type": "color",
"id": "bg_color",
"label": "Background Color",
"default": "#f9fafb"
}
],
"blocks": [
{
"type": "feature_card",
"name": "Feature Card",
"settings": [
{
"type": "image_picker",
"id": "card_image",
"label": "Card Icon / Image"
},
{
"type": "text",
"id": "card_title",
"label": "Feature Title",
"default": "Core Feature"
},
{
"type": "richtext",
"id": "card_content",
"label": "Description",
"default": "<p>Add a short description here with rich text formatting.</p>"
}
]
}
],
"presets": [
{
"name": "Feature Showcase",
"blocks": [
{ "type": "feature_card" },
{ "type": "feature_card" },
{ "type": "feature_card" }
]
}
]
}
{% endschema %}
Dynamic Sources and Metaobjects: Less Hardcoded Logic
Stores frequently need per-product content: fabric care instructions on apparel, warranty terms on electronics, or a size guide per brand. Instead of writing long if/else chains in Liquid, you can wire those fields up in Admin using Dynamic Sources and Metaobjects.
Connecting Dynamic Sources
Next to most text, image, and URL inputs in the Theme Editor, there is a small cylinder icon for connecting a dynamic source. Merchants can click it to bind that setting directly to a product or collection metafield—no code changes needed.
For instance, binding a text block to product.metafields.custom.care_guide makes every product page pull its own care instructions automatically. Updating a product’s metafield in Admin updates the storefront right away.
Managing Grouped Content with Metaobjects
A single metafield works well for one line of text or one image. When you need a reusable record with several fields—such as a designer bio (photo, name, short bio, social link) or a retail store location (address, hours, phone)—Metaobjects are a much better fit.
Think of a metaobject as a small custom table inside Shopify Admin. For a designer profile:
- Define a “Designer” metaobject with
avatar,name, andbiofields, then add entries for each designer. - Add a product metafield that references a Designer entry.
- Read the fields directly in Liquid:
{%- assign designer = product.metafields.custom.designer.value -%}
{%- if designer != blank -%}
<aside class="designer-bio p-6 bg-gray-50 rounded-xl my-8 border border-gray-200">
<h4 class="text-sm font-semibold text-gray-500 uppercase tracking-wider">Meet the Designer</h4>
<div class="mt-4 flex items-center space-x-4">
{%- if designer.avatar != blank -%}
{{ designer.avatar | image_url: width: 80 | image_tag: class: 'w-12 h-12 rounded-full object-cover', alt: designer.name }}
{%- endif -%}
<div>
<p class="text-base font-bold text-gray-900">{{ designer.name }}</p>
<p class="text-sm text-gray-600">{{ designer.bio }}</p>
</div>
</div>
</aside>
{%- endif -%}
If twenty products share the same designer, updating that designer’s photo or bio once updates all twenty product pages at the same time—without maintaining a separate CMS.
Theme App Extensions: Installing Apps Without Polluting Code
OS 2.0 requires modern storefront apps to integrate through Theme App Extensions rather than editing theme.liquid. Apps surface on the storefront in two ways:
- App Blocks: Contained widgets such as star ratings, review lists, or size helpers. Merchants can drag an App Block above the buy buttons or below the description just like a native section block.
- App Embeds: Site-wide scripts such as live chat bubbles, analytics pixels, or cookie banners. Merchants toggle them on or off under the Theme Editor’s “App embeds” tab.
Because Shopify hosts the app’s extension assets separately, turning off an embed or uninstalling the app removes it cleanly from the JSON configuration—leaving zero leftover scripts or broken snippets in your theme repository.
Code Quality and Speed: render, Theme Check, and Web Vitals
Beyond folder structure, OS 2.0 enforces stricter Liquid habits and storefront speed expectations.
Use {% render %} Instead of {% include %}
Older themes used {% include 'snippet-name' %}, which exposed every variable from the parent template inside the snippet. Worse, changing a variable inside the snippet mutated it in the parent template too, causing subtle bugs.
OS 2.0 replaces include with {% render 'snippet-name' %}. Variables inside render are isolated by default; anything the snippet needs must be passed in explicitly (for example, {% render 'price', product: product %}). That keeps variable scope predictable and lets Shopify cache rendered snippets faster on the server.
Catch Mistakes Early with Theme Check
Shopify’s Theme Check works like ESLint for Liquid and JSON files. Running it in VS Code or as a Git pre-commit hook catches common mistakes right away:
- Synchronous
<script>tags missingdeferorasyncthat block page rendering; - Missing snippet paths or deprecated Liquid tags and filters;
- Unused variables and snippets adding clutter.
Practical Speed Targets
Mobile speed directly affects checkout conversion. When testing a theme on real product pages, these targets are a solid baseline:
| Metric | Practical Target | What Helps Most |
|---|---|---|
| Mobile Lighthouse Score | ≥ 85 / 100 | Remove render-blocking JS, trim web fonts, output above-the-fold HTML in Liquid |
| Largest Contentful Paint (LCP) | < 2.0 s (4G network) | Never lazy-load the hero image; use image_tag so Shopify serves WebP/AVIF |
| Total Blocking Time (TBT) | < 200 ms | Skip heavy global frameworks; use plain JS or Web Components for UI interactions |
| Theme JS Size | < 150 KB (theme code) | Split scripts with Vite so pages only load the JS they actually use |
| Cumulative Layout Shift (CLS) | < 0.1 | Set explicit aspect-ratio or dimensions on images, videos, and embeds |
7 Practical Best Practices for Daily Development
Getting the folder structure and syntax working is step one. When maintaining a theme over months or years, these habits prevent most day-to-day headaches (and match how Shopify builds Dawn):
1. Use Section Groups for the Header and Footer Instead of Hardcoding Them
Older themes often hardcode {% section 'header' %} and {% section 'footer' %} directly inside layout/theme.liquid. Once hardcoded, the store team cannot drag a countdown bar above the header during a sale or add a newsletter strip right above the footer.
Instead, create header-group.json and footer-group.json inside sections/, and render them in theme.liquid like this:
{% sections 'header-group' %}
<main id="MainContent" role="main">
{{ content_for_layout }}
</main>
{% sections 'footer-group' %}
Now the global header and footer areas support adding, removing, and reordering sections just like any page template.
2. Include @app Block Support in Core Sections
App Blocks only work if your section explicitly accepts them. If you write a custom main-product.liquid and forget to declare the @app block type, merchants who install a reviews or installment-payment app will find nowhere to place it in the Theme Editor.
Always include @app in both the block loop and the schema of core sections:
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when '@app' -%}
{% render block %}
{%- when 'title' -%}
<h1>{{ product.title | escape }}</h1>
{%- endcase -%}
{%- endfor -%}
{% schema %}
{
"name": "Main Product",
"blocks": [
{ "type": "@app" },
{ "type": "title", "name": "Product Title", "limit": 1 }
]
}
{% endschema %}
3. Use the Section Rendering API for Partial UI Updates
When updating quantities in a slide-out cart drawer or switching product variants, avoid rebuilding complex HTML strings in JavaScript. Maintaining currency formatting and sale-price badges in both Liquid and JS almost always leads to subtle mismatches.
Use Shopify’s Section Rendering API instead. Pass ?sections=cart-drawer,cart-icon-bubble with your request, and Shopify returns fresh server-rendered HTML strings ready to swap into the DOM:
const res = await fetch(`${window.Shopify.routes.root}cart/change.js`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
id: lineItemKey,
quantity: newQty,
sections: 'cart-drawer,cart-icon-bubble'
})
});
const data = await res.json();
document.querySelector('#CartDrawer').innerHTML = data.sections['cart-drawer'];
4. Wrap Interactive Widgets in Web Components so Theme Editor Previews Stay Alive
Whenever a merchant tweaks a color, changes a heading, or drags a section in the Theme Editor, Shopify destroys that section’s old DOM node and inserts newly rendered HTML. If your sliders or accordions bind events once on DOMContentLoaded, they stop working the moment a setting changes in the editor.
Native Web Components solve this cleanly. Wrapping an interactive widget in a custom tag like <product-gallery> means the browser automatically runs connectedCallback() whenever the Theme Editor re-inserts the element, and disconnectedCallback() when removing it—without needing manual shopify:section:load listeners everywhere.
5. Load Section CSS and JS on Demand Instead of One Giant Bundle
Modules like video modals, size-chart popups, or FAQ accordions only appear on a handful of pages. Bundling all their styles and scripts into a single global base.css and global.js forces shoppers on the homepage to download code they never use.
Split specialized styles and scripts into small files and load them at the top of the section that needs them:
{{ 'section-faq.css' | asset_url | stylesheet_tag }}
<script src="{{ 'faq-accordion.js' | asset_url }}" defer="defer"></script>
Browsers and Shopify deduplicate external asset URLs automatically, so placing two FAQ sections on the same page will not download or execute the script twice.
6. Treat Above-the-Fold Hero Images Differently from Lazy Images
A blanket rule putting loading: 'lazy' on every <img> tag will hurt your mobile Largest Contentful Paint (LCP). When the main hero banner or primary product photo is lazy-loaded, the browser waits until layout finishes before fetching the most important image on screen.
Split images into two clear cases:
- First visible hero or product image: Omit lazy loading, add
fetchpriority: 'high', and passwidthsandsizesso mobile phones download an appropriately sized image. - Below-the-fold images (and carousel slides after the first): Add
loading: 'lazy'.
{%- comment -%} Above-the-fold hero image: high priority + responsive widths {%- endcomment -%}
{{
section.settings.hero_image
| image_url: width: 2000
| image_tag:
fetchpriority: 'high',
sizes: '100vw',
widths: '375, 550, 750, 1100, 1500, 2000',
class: 'w-full h-auto object-cover'
}}
7. Keep Schema Settings Focused Instead of Building a “Cockpit”
It is tempting to expose font-size sliders, four-sided pixel padding controls, and ten separate color pickers on every section. In practice, overwhelming the sidebar makes it easy for the store team to create inconsistent spacing and unreadable color combinations across pages.
Give merchants guardrails rather than raw CSS knobs:
- Use global color schemes: Use Shopify’s
color_schemesetting with pre-tested palettes (e.g., Light, Soft Gray, Brand Dark) so text contrast always stays readable. - Offer preset spacing steps: A dropdown with Compact / Standard / Spacious keeps vertical rhythm far cleaner than raw 1px sliders.
- Keep sections single-purpose: Aim for 5 to 8 settings per section rather than cramming multiple layouts into one giant module.
Team Workflows: Avoiding Overwritten Merchant Settings
The easiest mistake on an OS 2.0 project has nothing to do with Liquid syntax—it happens when developers and merchants update the same JSON files.
Whenever the store team reorders sections, swaps hero banners, or changes colors in the Theme Editor, Shopify saves those edits straight into the live theme’s templates/*.json and config/settings_data.json. If a developer still has last week’s JSON files locally and runs:
shopify theme push
those stale local JSON files will overwrite the live configuration and wipe out the store team’s recent layout changes.
Four habits prevent that from happening:
- Run two-way sync during local development: Pass
--theme-editor-syncwhen starting Shopify CLI 3.x:
Edits made in your development theme’s Theme Editor write back to your local JSON files immediately, keeping both sides in sync.shopify theme dev --store your-shop.myshopify.com --theme-editor-sync - Never develop against the live theme: Work on
feature/*branches in Git and connectshopify theme devto an isolated Development Theme. - Pull live JSON settings before opening a PR: Before merging code, pull the latest merchant JSON configuration into your branch and commit it:
shopify theme pull -d -o *.json - Deploy to an unpublished theme first: Let GitHub Actions build assets and run
shopify theme check, then push to an Unpublished staging theme so QA and the store team can preview everything before publishing it live.
Wrapping Up
Online Store 2.0 does not make theme development more complicated—it takes repetitive layout wiring off your plate. Page order lives in JSON templates, per-product content comes from dynamic sources and metaobjects, and third-party widgets plug in through App Blocks.
Once folder boundaries, render scoping, clean schemas, and JSON sync habits are in place, the store team can build and adjust pages without filing developer tickets, and developers can focus on custom components and storefront performance.
Further Reading
- Shopify Theme Development: Buy, Customize, or Build Your Own? — Deciding between off-the-shelf themes, theme customization, custom themes, and headless storefronts
- Shopify Apps vs. Storefronts: Capabilities, Trade-Offs, and Architecture Decisions — How backend app logic and storefront UI fit together
- Shopify Theme Architecture Documentation
- Shopify Theme Check Documentation