Hi,
I’m looking for some assistance with hiding the prices of products that belong to a specific collection on my Shopify store. I have a collection named “Entreprises / événements,” and I want to hide the prices for all products in this collection when they are displayed on the “All Products” page (https://tranchedecake.be/collections/all).
I’ve tried adding some Liquid code to the theme.liquid file before :
{% if template == ‘collection’ and collection.handle == “entreprises-evenements” %}
.price {
display: none !important;
}
{% endif %}
but I haven’t had any success so far.
Could someone please guide me on how to hide the prices for these specific products in the product grid? Any help would be greatly appreciated!
Thank you in advance,
Isaure
Hi @Isaura_1 ,
Try replacing “==” with “contains” here
It still doesn’t work when replacing “== " by"contains”
I’ve been trying to hide the prices for products that belong to a specific collection on the “All Products” page (/collections/all), but I’m running into some issues because when I use the following code in my theme.liquid file:
{% if template contains 'collection' and collection.handle == "all" %}
<style>
{% for product in collection.products %}
{% assign product_collections = product.collections | map: 'handle' %}
{% if product_collections contains 'entreprises-evenements' %}
.product-{{ product.id }} .price {
display: none !important;
}
{% endif %}
{% endfor %}
</style>
{% endif %}
this code ends up hiding the prices for all products on the /collections/all page, not just the products from the specific collection “Entreprises / événements.”
Moreover, I suspect the collection template doesn’t load products within the collection’s context, which makes it difficult to target only the products from the specific collection.
Could someone please help me figure out how to correctly target and hide the prices for products from a specific collection on the “All Products” page without affecting the prices of other products?
@Isaura_1 , Try this and tell me if it works 
{% if template contains 'collection' and collection.handle == 'all' %}
{% assign target_collection_handle = 'entreprises-evenements' %}
{% for product in collection.products %}
{% assign product_collections = product.collections | map: 'handle' %}
{% if product_collections contains target_collection_handle %}
{% endif %}
{% endfor %}
{% endif %}
It’s unfortunately not working with that code 