Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
hello Community !
I want to add specific collection name below product name ,but by default random or may be first collection is popping up,is there any way i can target specific collection.
In the screenshot you can see collection name showing as New arrival & Men as these products are added to multiple collection , but i want Oversized collection to appear ,please help me if you are aware about the solution.
Thank you !
code i used :
{% assign pro_collection = product.collections.first %} {% if pro_collection %} This product is part of my {{ pro_collection.title | link_to: pro_collection.url }} Collection {% endif %}
Hey, @ParthPapat thanks for posting here.
please use this method to show specific collection on product card
{% assign specific_collection = "Oversized" %}
{% assign matched_collection = null %}
{% for collection in product.collections %}
{% if collection.title == specific_collection %}
{% assign matched_collection = collection %}
{% endif %}
{% endfor %}
{% if matched_collection %}
This product is part of my
<a href="{{ matched_collection.url }}">{{ matched_collection.title }}</a> Collection
{% else %}
No matching collection found.
{% endif %}
2m ago Learn the essential skills to navigate the Shopify admin with confidence. T...
By Shopify Feb 12, 2025Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025