How to display 'tartar care' logo for a specific collection and its products?

I need the “tartar care” logo to only appear for the collection and all the products. So here:

https://tartar-berlin.com/collections/tartar-care

and here and all other products under the collection:

https://tartar-berlin.com/collections/tartar-care/products/lederpflegeburste-rosshaar-hell

Like on the collection page:

on the rest of the website you should see this:

this is the code I have which only displays the “tartar-care” logo on the tartar-care collection site and not on the tartar-care products:

{% if template contains "collection" and collection.handle == "tartar-care" %}
{% assign logo_src="https://cdn.shopify.com/s/files/1/2479/2738/files/TARTAR-Care-Logo-Web-transparent.png?v=1614004087" %}
{% else %}
{% assign logo_src="https://cdn.shopify.com/s/files/1/2479/2738/files/TARTAR-webheader_2f64f81d-e65a-4f1e-99ab-6766355f38de.jpg?17689223928869986124" %}
{% endif %}

I’ve tried everything and nothing works so I would really appreciate your help! Thank you!

Hi @Elisaw

Aibek is here from Speedimize.io

Instead of “and” use “or”.

It must be like this:

{% if collection.handle == "all" or collection.handle == "tartar-care" %}

Instead of all, you can use the old template contains “collection” code. But in this case, it will show in all collections. So we specified all. You can change it as you want.

For the product page, you need to use a different code. For example, inside product-template. liquid:

{% for collection in product.collections %}
  {% if collection.handle == 'tartar-care' %}
      // here inser logo
    {% break %}
  {% endif %}
{% endfor %}

Hope that helps you.

@Anonymous thank you so much!!! Actually with the small change in the first code snippet it works without having to add it to the product page :slightly_smiling_face:

So glad to hear that!

Good job @Elisaw

We’re glad to help you!

@Anonymous thank you! I need help with another small thing, maybe you are able to help me with your amazing skills again. I need the logo from “tartar-care” to link to the tartar-care collection (https://tartar-berlin.com/collections/tartar-care) and all other logos should link to the index page (https://tartar-berlin.com). Right now there is this in the code that is linking the tartar-care logo back to the collection but the logo (see screenshot) on the other parts of the page doesn’t link anywhere.

{% if collection.handle == "all" or collection.handle == "tartar-care" %}
	{% assign logo_src="https://cdn.shopify.com/s/files/1/2479/2738/files/TARTAR-Care-Logo-Web-transparent.png?v=1614004087" %}
      {% else %}
	{% assign logo_src="https://cdn.shopify.com/s/files/1/2479/2738/files/TARTAR-webheader_2f64f81d-e65a-4f1e-99ab-6766355f38de.jpg?17689223928869986124" %}
  {% endif %}
 
  
    
      
    
  

Thanks again for your help I appreciate it greatly!

Hi @Elisaw

Thanks for getting back to me and your kind words.

We always try to do our best.

Here you can use this code:

{% assign url = "https://tartar-berlin.com/" %}
{% if collection.handle == "all" or collection.handle == "tartar-care" %}
    {% assign logo_src="https://cdn.shopify.com/s/files/1/2479/2738/files/TARTAR-Care-Logo-Web-transparent.png?v=1614004087" %}
    {% assign url = "https://tartar-berlin.com/collections/tartar-care" %}
{% else %}
    {% assign logo_src="https://cdn.shopify.com/s/files/1/2479/2738/files/TARTAR-webheader_2f64f81d-e65a-4f1e-99ab-6766355f38de.jpg?17689223928869986124" %}
{% endif %}

    
        
    

Hope that helps you.

@Anonymous thanks so much for your help and quick responses! works perfectly :slightly_smiling_face: