Templates
Templates control what’s rendered on each page in a theme.
Each page type in the storefront should have an associated template type. These can be used to add functionalities and experiences that belong in said pages. For example, to render a product page, the theme needs at least one template of type product likewise for cart.
Location
Templates are located in the templates directory of the theme
└── theme
├── layout
├── templates
│ ├── article.json
│ ├── product.json
│ ...
...Format
Templates are JSON files. Each one lists the sections that render on the page, their order, and their settings, and the theme editor reads and writes this file as sellers customize the page. See JSON templates for the full property reference.
Template types
Each available template type represents a type of page that is available in the seller’s storefront. No types are required, but you must have implemented a type for each page that you want to render, otherwise it will fall back to the defaults.
| Type | Description |
|---|---|
page | Renders a standalone content page. |
cart | Renders the cart page. |
index | Renders the store's landing page. |
search | Renders the search results page. |
product | Renders the product page. |
thankyou | Renders the post-purchase thank-you page. |
collection | Renders a single collection's products. |
list-collection | Renders the list of all collections. |
upsell | Renders the upsell offer page. |
Content
Let the template type's purpose drive its content. A product template (or a section it references) needs the product object to render details and the product form tag to let customers add a variant to the cart. Put shared building blocks in a section and reference it from the template.