I’m new in Shopify and looking for suggestions to implement a specific size chart to add product page. Adding some code in sections->product-template.liquid to get size chart using this code to filter with the product.type
{% if product.type == 'mens' %}
// put your tank top sizing chart here
{{ pages.mens-size-chart.content }}
{% endif %}
{% if product.type == 'women' %}
// put your tank top sizing chart here
{{ pages.women-size-chart.content }}
{% endif %}
This work but, I don’t want to filter with the product.type .There is any way to add some dropdown in admin new product panel and get this filed to show size chart without adding any app its possible.
2
Answers
I can think of at least 5 approaches you can use in this case.
Section
Create a section for the product with blocks.
Each block will have the following fields:
product
field, where you will select the productpage
field, where you will select the page you wantThen loop the blocks and look if the product field is equal to the product handle and use that page
Link List
Create a link list with products.
The title will be the page handle and the url will be the product.
You loop each link in the navigation and check if it’s url is equal to the product handle. If yes, you use it’s title to get the page content.
Prefix pages
Since you are creating pages based on the type, you can prefix them. So if the type is “mens” the page can be called
product_mens
and you will get the page based on the product type with theproduct_
prefix.Settings
You can create a textarea with a similar syntax:
You use the filter
newline_to_br
, split the result by br, loop each item and split it by|
and you got the product-handle and the page handle that you can check.Tags
You can use prefixed tags, that can target the page. The same as the prefixed pages, here you create a tag with the page-handle and add some kind of prefix to it. Then you loop all of the tags and check if there is a page with any of the prefixed tags.
Here is the step by step documentation to add size chart to product pages.
Shopify create size chart