Shopify Theme Templates in Theme 2.0
Shopify Theme 2.0 introduced a more flexible and modular template system, allowing for better customization with JSON-based templates and sections everywhere.
Location
Template files are located in the templates
directory of the theme
└── theme
├── layout
├── templates
| ├── 404.json
| ├── article.json
| ...
...
JSON vs. Liquid
There are two different file types you can use for a theme template: JSON and Liquid.
Feature | JSON Templates (Theme 2.0) | Liquid Templates (Older Method) |
---|---|---|
Flexibility | Highly flexible, supports drag-and-drop in the Shopify Theme Editor. | Less flexible, requires manual coding for layout changes. |
Customization | Allows merchants to modify layouts using sections in the Theme Editor. | Customization requires direct changes in Liquid code. |
File Format |
|
|
Usage | Defines the structure of a page by listing sections and their order. | Uses Liquid code to include sections and apply logic. |
Support for Sections | Supports sections everywhere (e.g., product, collection, blog pages). | Only allowed sections in certain page types (e.g., homepage). |
Coding Requirement | No coding needed—sections are controlled via the Theme Editor. | Requires knowledge of Liquid to customize templates. |
Logic Handling | No logic—only defines page structure and sections. | Can include advanced Liquid logic (if-else, loops, etc.). |
Example File |
|
|
Best Use Case | When you want easy customization without coding. | When you need advanced logic that JSON templates can’t handle. |
Shopify Recommendation | Recommended for all new themes (Theme 2.0). | Used in older themes or for complex conditional logic. |
Choosing JSON vs Liquid
If you want to use sections in a template, then you should use a JSON template.
JSON templates provide more flexibility for merchants to add, remove, and reorder sections, including app sections. Additionally, they minimize the amount of data in settings_data.json. Instead, data is stored directly in the template, which improves the performance of the theme editor.