Shopify themes, liquid, logos, and UX
Hey guys, I might need your help with something. I am looking for solution how to add to vendor collection name. I have found this code and put it to main product liquid:
{% for collection in product.collections %}
<p class="collection-title">{{ collection.title }}</p>
{% endfor %}
It is working just fine BUT If the product has more collection, then it shows all of them. Is there any solution how to edit this code to show only one collection and not all of them? Thank you
Hi @Vlk1 ,
May I suggest 2 solutions below:
1. code to show the first collection
{% assign collection = product.collections | first %}
{{ collection.title }}
2. Add "within: collection" to url of product. In product liquid only use {{ collection.title }} to show it.
Hey, thank you. I am not sure if I got it right but when I put it to product liquid, nothing happend.
Hi,
If you used in Assets/card_product.liquid. May I suggest code below:
{% assign collection = card_product.collections | first %}
{{ collection.title }}
I have edited it but it shows still name of my store as a vendor, not collection
Hi,
Could you please share your store url that you applied code?
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024