Shopify themes, liquid, logos, and UX
Hey
I added a collapsible row to add a size chart
But I noticed now all of my products have a collapsible row (only the ones I populated with metafield page have content in them, the rest are empty)
I want to have the collapsible row only for those 6 products I need it for, and have the collapsible row disappear from the other products.
How can I do that?
Thank you 🙂
Hi @Oneg
To fix this you can add a common tag on those 6 products and put the metafield code in the condition like below.
<!-- Extra info for custom tags -->
{% for tag in product.tags %}
{% if tag contains 'myTag' %}
//Your metafield code here
{% endif %}
{% endfor %}
This code will prevent the metafield code to populate on all the products and will appear only on the products that have your added tag on 6 products.
Thanks
Sheesh B
Can you explain where we need to place this code? If I only want the collapsible rows for 1 product, do I put this code in the description of the product? And do I add 'myTag' to the product tags? What goes here: //Your metafield code here ? Thanks!
Hi @Markslwn48
The above code is to show the metafields on selected products and we can refine the products if we add a specific tag on products.
For ex. if we add mytag on 5 products then, the metafields will appear on 5 products only.
Let me know if anything I can help.
Thanks
Sheesh B
Hi @Oneg ,
As collapsable rows are part of "main-product.liquid", you will have to update this file to achieve it. If you are using dawn theme, you can add bellow codes on the file.
On line number 193 add
{% unless block.settings.content == "" and block.settings.page == "" %}
On line number 211 add
{% endunless %}
The updated code should look like this [Text marked in red are code that i have added]
If you require further help to add the code to your store, please don't hesitate to reach out. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!
Best Regards,
Mangit
hey thank you for the reply, it didn't work for me, placed the codes exactly like your picture showed inside main-product.liquid.
To be clear, I want the whole drop down list in the picture to disappear. For this product in the picture, I didn't put a size chart, it's irrelevant. But I do want this size chart drop down to exist in other products where it's relevant.
Hi @Oneg
Did you added the tag to product where it's relevant?
In my code I'm using 'myTag', you can specify your tag and change that tag in the code as well where it says myTag.
<!-- Extra info for custom tags --> {% for tag in product.tags %} {% if tag contains 'myTag' %} //Your metafield code here {% endif %} {% endfor %}
I hope this explains.
Thanks
Sheesh B
hey, where do i paste this code?
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024