Can you hide product title of a targeted collection?

Highlighted
New Member
2 0 0

Hi,

Can you hide the product title of a single collection of products ?

 

I made a subset of collections on a page and want to hide from two of those collections the titles of the products when you click on them
If i comment out this piece of code in product-grid-item.liquid all the titles everywhere disappear but that's not what i want.

  <div class="product__title text-center">
    <a href="{{ product.url | within: collection }}">{{ product.title }}</a>
  </div>

 is there a way to target a collection with a "if" statement something like this :
"if collection == earrings; title's hide;"

I am using the Simple theme + some modifications to make the subset of collections possible.

0 Likes
Highlighted
Trailblazer
133 29 42

@jaylow Please try to use the following code.

 

{% assign collection_titles = '' %}
{% for collection in product.collections %}
    {% assign collection_titles = collection_titles | append: collection.title %}
{% endfor %}
{% unless collection_titles contains 'Your collection title here' %}
    <div class="product__title text-center">
        <a href="{{ product.url | within: collection }}">{{ product.title }}</a>
    </div>
{% endunless %}

 

- Was my reply helpful? Click Like and Accept as Solution
- Want to implement a custom solution? Feel free to contact me at waqas4346@gmail.com
Highlighted
New Member
2 0 0

that works perfect for one collections.

Thank you very much!

0 Likes