Help regarding custom design - show or hide a Shopify product page template based on a product tag

Solved
Uros-Uros
Excursionist
21 1 3

Hi,

 

I would like to know if it's possible to insert a custom field for templates on product pages, where we could insert a product tag and the template would be shown or hidden, depending if the product has the same tag or not.

https://imgur.com/7NPSiA9

Here is the image, and on the left we would need a field where we could insert the product tag.

 

Thank you

Accepted Solution (1)

Accepted Solutions
KG123
Shopify Partner
22 5 1

This is an accepted solution.

If you want to add a custom field to an existing section, then the answer is yes you can.

At the bottom of the source code for that particular section, you will see a big {% schema %} section. If you add new fields in here, they will appear in that left hand window, and you can then refer to those fields in the code with {{ section.???? }} to do certain things. In your case, it sounds like you want to check certain tag values, and show them or not. 

 

You'll need a bit of coding / liquid experience, but assuming you do, its shouldn't be too bad.

 

This reference explains how to add fields to the schema

https://shopify.dev/themes/architecture/sections/section-schema

 

By the way, unless you particularly need your Shopify admin to be multi language, you don't need to worry about all the language translations.

 

"label": "My Custom Field"

 

Will do, rather than the dozen or so locales.

 

Hope that helps,

 

Kevin.

View solution in original post

Reply 1 (1)
KG123
Shopify Partner
22 5 1

This is an accepted solution.

If you want to add a custom field to an existing section, then the answer is yes you can.

At the bottom of the source code for that particular section, you will see a big {% schema %} section. If you add new fields in here, they will appear in that left hand window, and you can then refer to those fields in the code with {{ section.???? }} to do certain things. In your case, it sounds like you want to check certain tag values, and show them or not. 

 

You'll need a bit of coding / liquid experience, but assuming you do, its shouldn't be too bad.

 

This reference explains how to add fields to the schema

https://shopify.dev/themes/architecture/sections/section-schema

 

By the way, unless you particularly need your Shopify admin to be multi language, you don't need to worry about all the language translations.

 

"label": "My Custom Field"

 

Will do, rather than the dozen or so locales.

 

Hope that helps,

 

Kevin.