Change product template

Hi Everyone,

Hope you’re doing good.

I want to change the template for specific products as I have two categories (Clothing & Jewellery)

I’ve managed to add size chart page for the clothing items. But if I delete this or even hide this for jewellery item

How do I remove it from specific products?

Thank you

Hi @hritikakhattar

You can create 2 product templates and assign them to products in each category

https://help.shopify.com/en/manual/online-store/themes/theme-structure/templates

Hey @hritikakhattar

Share your Store URL and Password if enabled.

Best Regards,

Moeed

Hi @hritikakhattar
I understand you want to hide or delete the size chart for jewelry items. You can achieve this by modifying the conditional logic in your Liquid template to ensure that the size chart only appears for clothing items. Here’s how you can do it
Add Conditional Logic Based on Product Type or Tag : Modify the Liquid code to display the size chart only for clothing items. Here’s an example of how you can do this using a product tag:

{% if product.product_type == 'Clothing' %}
  <!-- Size chart metafield -->
  {% unless product.metafields.custom.size_chart == blank %}
    <div class="size-chart">
      {{ product.metafields.custom.size_chart }}
    </div>
  {% endunless %}
{% endif %}

Hey @hritikakhattar ,

You can follow this documentation from Shopify about creating new templates: https://help.shopify.com/en/manual/online-store/themes/theme-structure/templates#create-a-new-template
This documentation for applying a new template to the products: https://help.shopify.com/en/manual/online-store/themes/theme-structure/templates#bulk-template-changes

Also you can take a look at this video for the practical implementation: https://www.youtube.com/watch?v=rppKgzoAkQc

I hope this helps!

Regards,

Abhishek from Swym

Could you please let me know where to paste the code?
That would be great

Please find the store link below

https://boutu.in/

Hey @hritikakhattar

Follow these Steps:

  1. Go to Online Store

  2. Edit Code

  3. Find theme.liquid file

  4. Add the following code in the bottom of the file above tag

{%- assign product_collections = product.collections | map: 'handle' -%}
{%- if product_collections contains 'jewellery_all' -%}

{%- else -%}

{%- endif -%}

RESULT:

If I managed to help you then, don’t forget to Like it and Mark it as Solution!

Best Regards,
Moeed

Thank you so much
It workedddd

Thank you for your reply. I’m glad to hear that the solution worked well for you. If you require any more help, please don’t hesitate to reach out. If you find this information useful, a Like would be greatly appreciated.