/

August 5, 2024

How To Create Custom Product Template In Shopify

When we select any Shopify theme for our store, it provides default page templates for every page such as the homepage, product page, collection page, cart pages, and many more. Customizing the default page templates for any product or collection applies to all the products or collections in the store. If you need a different layout for different categories of products, you can also create a custom product template in your theme.

For example, if you are selling clothes for men, women, and children then create different templates for all. that time designed different custom templates for all.

 

Step 1: Go to Shopify admin click on Themes -> Actions -> Edit code.

 

Step 2: In the left sidebar there are more sections like templates, sections, assets many more. select templates and add a new template.

 

Step 3: Create a template for the product so write the product.

template type selects JSON file in Shopify 2.0 and if you are in Shopify version 1.0 then select the liquid type.

Name of the file: custom-product

and submit the green button to create a template.

Step 4: Now remove all the code from the newly created product template. This file should be blank.

Step 5: Open product.json (for Shopify 2.0 themes or “product. liquid” for other themes) from the Templates folder.

Step 6: Now copy all the code in the product.json and paste it into your new product template.

Step 7: Replace the “main-product” with “custom-product” in your new product template.

Step 8: Click on the Save button.

 

Step 9: Now open the section from the left sidebar and add a new section.

Step 10: remove all the default code from the newly created section.

Step 11: Copy all of the content from your main product. liquid file (in the Sections directory), and paste it into your new custom product.liquid file.

Step 12: Click on the Save button.

 

Now you can customize this new product template from the theme editor. For that go to Online Store > Themes and click on the Customize button(header search).

Then, open the custom product template and customize it using Shopify sections, blocks, and meta fields.

Steps to Change Product Page Shopify

Step 1: Click on the Products tab from the Shopify Admin.

Step 2: Open the product you want to assign to the custom template.

Step 3: Scroll down to the Online store section.

Step 4:  Now select your custom template from the Theme template dropdown.

 

From the same category