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.

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:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme that you want to edit, and then click Customize.
  3. Click the Home page drop-down menu, and then select the template that you want to edit.
  4. To add a new section to the template, click Add section, and then select a new section for your template.
  5. Optional: To add a block to your new section, click Add block, and then select a new block for your section.
  6. Click the new section and blocks to view their settings and options, and then make your changes.
  7. Click Save.

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

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme that you want to edit, and then click Customize.
  3. Click the Home page drop-down menu, select a template type, and then click Create template.
  4. In the Create a template dialog, do the following:
    • In the Name field, enter a unique name for your new template.
    • In the Based on drop-down menu, select the existing template that you want to base your new template on.
  5. Click Create 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:

  1. 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.
  2. 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:

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme that you want to preview a template with, and then click Customize.
  3. Click the Home page drop-down menu, and then select the template that you want to use.
  4. In the Preview section in the theme editor sidebar, click Change.
  5. Click the resource that you want to preview with the selected template.

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

  1. From your Shopify admin, go to Online Store > Pages.
  2. Click the page that you want to apply a new template to.
  3. In the Online store section, click the Theme template drop-down menu, and then select the template that you want to apply to your page.
  4. Click Save.

Apply a new template to a product

  1. From your Shopify admin, go to Products.

  2. Click a product that you want to apply a new template to.

  3. In the Theme template section, click the drop-down menu and then select the template that you want to apply to your product.

  4. Click Save.

Apply a new template to a collection

  1. From your Shopify admin, go to Products > Collections.
  2. Click a collection that you want to apply a template to.
  3. In the Theme template section, click the drop-down menu and then select the template that you want to apply to your collection.
  4. Click Save.

Apply a new template to a blog

  1. From your Shopify admin, go to Online Store > Blog posts.
  2. Click Manage blogs.
  3. Click a blog that you want to apply a template to.
  4. In the Online store section, click the Theme template drop-down menu, and then select the template that you want to apply to your blog.
  5. Click Save.

Apply a new template to a blog post

  1. From your Shopify admin, go to Online Store > Blog posts.
  2. Click a blog post that you want to apply a template to.
  3. In the Online store section, click the Theme template drop-down menu, and then select the template that you want to apply to your blog.
  4. Click Save.

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

  1. From your Shopify admin, go to Products.
  2. 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.
  3. Click Bulk edit.
  4. In the Bulk editor, click the Columns drop-down menu, and then in the General section, select Template.
  5. 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.
  6. 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

  1. From your Shopify admin, go to Products > Collections.
  2. 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.
  3. Click Bulk edit.
  4. In the Bulk editor, click the Columns drop-down menu, and then in the General section, select Template.
  5. 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.
  6. 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

  1. From your Shopify admin, go to Online Store > Themes.
  2. Find the theme with the template that you want to rename, and then click > Edit code.
  3. In the code editor, find the templates folder.
  4. Click the name of the template that you want to rename, and then click the pencil icon.
  5. In the Rename file dialog, enter a new template name in the File name field.
  6. Click Rename file.

Delete a template

  1. From your Shopify admin, go to Online Store > Themes
  2. Find the theme you want to delete a template from, and then click > Edit code.
  3. In the code editor, find the templates folder.
  4. Click the name of the template that you want to delete, and then click the trash can icon.
  5. In the dialog, click Delete file.
Can’t find the answers you’re looking for? We’re here to help.