Change product template

Solved

Change product template

hritikakhattar
Tourist
6 0 2

Hi Everyone,

Hope you're doing good.

 

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

 

hritikakhattar_0-1727159169483.png

 

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

hritikakhattar_1-1727159356445.png

 

How do I remove it from specific products?

Thank you

 

Accepted Solution (1)
Moeed
Shopify Partner
5334 1443 1727

This is an accepted solution.

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 </body> tag

{%- assign product_collections = product.collections | map: 'handle' -%}
{%- if product_collections contains 'jewellery_all' -%}
<style>
modal-opener.product-popup-modal__opener.quick-add-hidden {
    display: none;
}
</style>
{%- else -%}
<style>
modal-opener.product-popup-modal__opener.quick-add-hidden {
    display: inline-block;
}
</style>
{%- endif -%}

RESULT:

Moeed_0-1727166523352.png

 

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

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Custom Design | Advanced Coding | Store Modifications


View solution in original post

Replies 9 (9)

Dan-From-Ryviu
Shopify Partner
9534 1916 1950

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

- Helpful? Like and Accept solution! or Buy me coffee
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Ryviu: Aliexpress Reviews - AliExpress Reviews Importer, one-click import aliexpress reviews, export reviews to CSV file.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Moeed
Shopify Partner
5334 1443 1727

Hey @hritikakhattar 

 

Share your Store URL and Password if enabled.

 

Best Regards,

Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Custom Design | Advanced Coding | Store Modifications


hritikakhattar
Tourist
6 0 2

Please find the store link below

https://boutu.in/

Moeed
Shopify Partner
5334 1443 1727

This is an accepted solution.

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 </body> tag

{%- assign product_collections = product.collections | map: 'handle' -%}
{%- if product_collections contains 'jewellery_all' -%}
<style>
modal-opener.product-popup-modal__opener.quick-add-hidden {
    display: none;
}
</style>
{%- else -%}
<style>
modal-opener.product-popup-modal__opener.quick-add-hidden {
    display: inline-block;
}
</style>
{%- endif -%}

RESULT:

Moeed_0-1727166523352.png

 

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

 

Best Regards,
Moeed

- Need a Shopify Specialist? Chat on WhatsApp

- Custom Design | Advanced Coding | Store Modifications


hritikakhattar
Tourist
6 0 2

Thank you so much
It workedddd

 

Moeed
Shopify Partner
5334 1443 1727

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.

- Need a Shopify Specialist? Chat on WhatsApp

- Custom Design | Advanced Coding | Store Modifications


Sam416
Shopify Partner
35 2 4

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 %}

 

 

Shopify Expert | E-commerce Specialist | Custom Shopify App Development | Shopify Theme Customization & Bug Fixing | Buy Me A Coffee| Hire me| Contact Me on WhatsApp
hritikakhattar
Tourist
6 0 2

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

swym
Pathfinder
120 24 53

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-templa... 
This documentation for applying a new template to the products: https://help.shopify.com/en/manual/online-store/themes/theme-structure/templates#bulk-template-chang... 

 

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

- Appreciate the assistance. Show your approval with a Like! And when your question finds its answer, seal the deal by marking it as an Accepted Solution!
- Our Solutions: Wishlist Plus | Swym Back in Stock Alerts | Swym Gift Lists and Registries