Templates
Templates are a group of sections that are configured to give your online store a consistent design and feel. The sections that are available in your templates depends on your theme. In the theme editor, you can find which templates are applied to which pages, and then edit the templates to customize the information that you display to your customers.
When you edit a template, your changes apply to every page that uses the template. For example, if you add a newsletter signup form to a collections template, then all your collection pages that use the default collections template display the newsletter signup form.
On this page
Edit your templates
You can edit your templates to add sections to your online store. Some sections contain blocks that can be further customized, but not every section or block has settings or content that can be edited. When you edit your templates, your changes display in real time in the theme editor preview.
Steps:
Considerations for creating a new template
Before you create a new template, review the following considerations:
- You can have multiple templates for your products, collections, pages, blogs, and blog posts, but you can have only 1,000 templates in total.
- You can create a new template only with an Online Store 2.0 theme.
- All themes have a default template for collections, products, blogs, blog posts, and pages. These default templates are what your store's resources and content are displayed with, unless you create alternative templates.
- Any changes you make to a template impact all the pages that use that template. If you want to display some pages of a particular type differently, then you can create a new template based on one that already exists in your theme.
- When you create a new template from an existing template, your new template automatically populates with the same sections as your existing template. You can then remove, add, or hide sections, and edit their content as needed, without impacting the display of pages that use the existing template.
Create a new template
After you create a new template, you can apply the template to an online store page that you want to use it for.
Create a template for metaobjects
You can create a template for a web page for metaobjects. To use this feature, complete the following steps:
- Create a metaobject definition with Storefront access and, optionally, activate the Web pages feature manually. When you create a theme template, the theme editor activates the Web pages feature.
- Create entries for the metaobject definition.
You can now create a metaobject template in the theme editor.
Previewing templates
You can use template previews to preview how your online store resources, such as products and pages, display to your customers with a different template applied.
Templates are assigned on a product, collection, page, blog, or blog post level. You create and edit templates in the theme editor, but you change a resource's assigned template in your Shopify admin.
Considerations for previewing templates
Consider the following details when previewing templates for your different online store resources:
- When you preview a products template in the theme editor, you can use products that have Active status or Draft status, but you can't preview a product that has Archived status.
- When you preview a collections template in the theme editor, you need to ensure that the collection has Online Store activated as a sales channels. If a collection doesn't have Online Store activated as a sales channel, then you can't preview that collection with any collections templates in the theme editor.
- When you preview a pages template in the theme editor, you can use pages that have their visibility set as either Visible or Hidden.
- When you preview a blog posts template in the theme editor, you can use blog posts that have their visibility set as either Visible or Hidden.
Blogs don't have any different status or visibility parameters, so you can use a blogs template to preview any published blogs that you have in your online store.
Preview an alternate template
You can preview how your products, collections, pages, blogs, or blog posts display with a different template applied.
Steps:
Apply a new template
You can change an assigned template for the following sections in a published theme:
- pages
- products
- collections
- blogs
- blog posts
You change an assigned template in your Shopify admin. The template options that display are based on the available templates only in your current live theme.
Templates for products and collections can be assigned on an individual item level, or to multiple items at the same time using the Bulk editor.
Apply a new template to a page
Apply a new template to a product
Apply a new template to a collection
- From your Shopify admin, go to Products > Collections.
- Click a collection that you want to apply a template to.
- In the Theme template section, click the drop-down menu and then select the template that you want to apply to your collection.
- Click Save.
Apply a new template to a blog
Apply a new template to a blog post
Applying a new template to products or collections in bulk
You can use the Bulk editor to apply a new template to multiple products or collections in bulk.
Apply a new template to products in bulk
- From your Shopify admin, go to Products.
- To edit multiple products at the same time, do one of the following:
- To select products one by one, select the checkbox for each product.
- To select a range of products, click to select a product, and then hold the shift key and click another product. This selects the first and last products that you clicked, and all products in between.
- To select all products on a page, select the checkbox at the top of the product list.
- To select all products from your store, select the checkbox at the top of the products list, and then click Select all in this store.
- Click Bulk edit.
- In the Bulk editor, click the Columns drop-down menu, and then in the General section, select Template.
- Click the first field of the Template column, then hold the shift key, and then click the last field of the Template column. A blue shading displays around the items that you selected.
- Click the first field that you selected, then select the template that you want from the drop-down menu, and then click Save.
Apply a new template to collections in bulk
- From your Shopify admin, go to Products > Collections.
- To edit multiple collections at the same time, do one of the following:
- To select collections one by one, select the checkbox for each collection.
- To select a range of collections, click to select a collection, and then hold the shift key and click another collection. This selects the first and last collections that you clicked, and all collections in between.
- To select all collections on a page, select the checkbox at the top of the collections list.
- To select all collections from your store, select the checkbox at the top of the collection list, and then click Select all in this store.
- Click Bulk edit.
- In the Bulk editor, click the Columns drop-down menu, and then in the General section, select Template.
- Click the first field of the Template column, then hold the shift key, and then click the last field of the Template column. A blue shading displays around the items that you selected.
- Click the first field that you selected, then select the template that you want from the drop-down menu, and then click Save.
Managing your templates
To rename or delete a template, you need to use the code editor. Editing a template file might cause issues with your online store.
When you delete a template, any online store resources that had the template assigned to them are displayed with the default template until you assign a different one.
Rename a template
- From your Shopify admin, go to Online Store > Themes.
- Find the theme with the template that you want to rename, and then click … > Edit code.
- In the code editor, find the templates folder.
- Click the name of the template that you want to rename, and then click the pencil icon.
- In the Rename file dialog, enter a new template name in the File name field.
- Click Rename file.
Delete a template
- From your Shopify admin, go to Online Store > Themes
- Find the theme you want to delete a template from, and then click … > Edit code.
- In the code editor, find the templates folder.
- Click the name of the template that you want to delete, and then click the trash can icon.
- In the dialog, click Delete file.