[Porto Theme] Help with creating a custom product template

PB79
Pathfinder
124 2 42

Hi guys,

i got a little question regarding the custom porto theme. im new to liquid and am testing myself to victory with a staggering 5% success rate 😉

Goal: I want to create 2 custom product templates which are simply copies of the standard product template.

i opened my theme backend and discovered the "following" after some testing:

The standard product template seems to include the 2 following files:

Templates
- product.liquid

Snippets
- product_view_default.liquid

So i created my new files:

Templates
- product.test.liquid
- product.test2.liquid

Snippets
- product_test_view_default.liquid
- product_test2_view_default.liquid

The contents are the same of product.liquid + product_view_default.liquid

So far so good

i can see the new templates in the product editor:

templates.jpg

But how can i now "interlink" the product templates in the backend with the snippets? I dont know how to explain this better.

So if i choose the template product.test it will use the settings of the product_test_view_default.liquid snippet and not the

standard product_view_default.liquid.

 

I uploaded the 2 liquid files as txt. perhaps that helps figuring it out more easily

product.liquid.txt 

product_view_default.liquid.txt 

I would be very happy if someone could help me out 🙂

 

Have a nice day and take care.

Phil

Replies 7 (7)

PB79
Pathfinder
124 2 42

After digging through the internet i still find myself totaly lost 🙂

PB79
Pathfinder
124 2 42

Im still in need for a helping hand 🙂

sgr
Excursionist
11 0 8

Did you figure this out? I have the exact same problem

PB79
Pathfinder
124 2 42

Not yet.. sorry 😁

sgr
Excursionist
11 0 8

thanks for your reply, i figured it out. There's code in each of the files that links one to the other

PB79
Pathfinder
124 2 42

Would you mind sharing that with me?  🙂

sgr
Excursionist
11 0 8

In the code found near the top of the custom product template file in the templates section you will find:

 

{%- include 'product_view_NAMEOFYOURSNIPPET' -%}

 

Change this to the name of your snippet file eg. if your template file is product.wide.liquid and the corresponding snippet file is product_view_wide.liquid

 

The code would be:

 

{%- include 'product_view_wide' -%}