How to display specific Collections on a product or list page

Olivv
New Member
1 0 0

I have a shopify store with new, used and refurbished products.

This condition is stored in a manual collection (four of them). The others collections are being automated.

I would like to display the condition of the product on the product page or the products list.

So basically I need to get all the collections and filter to display one of the four :

If the product belongs to collection "used" display collection "used" If the product belongs to collection "new" display collection "new" etc...

The closest to what I want to do has been made trough this code :

{% assign product_collection = product.collections.first %}

{% if product_collection %}

This product is part of my {{ product_collection.title | link_to: product_collection.url }} Collection

{% endif %}

Found here : https://community.shopify.com/c/Shopify-Design/RESOLVED-Display-Collection-on-Product-Page/td-p/2308...

With this I am not able to filter on the only four collections, I want to display.

I have spent the day on this...If somebody can help, that would save my day

Thank you !

0 Likes