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?
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
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