Display vendor collection image in product page

Hi,

I want to display the vendor collection image, which is the vendor logo, in the product page from outside the collection, what I mean I don’t want to have to be in the collection for the logo to appear on the product page, I want it to appear even though I get to the product page from another collection or directly without passing by a collection at all.

I hope it makes sense.

Thank you

Hi @Eric_Ouellette2 ,

Please send your site and if your site is password protected, please send me the password. I will check it.

H @LitExtension ,

My website URL is https://ericsplugins.com

Thank you

Hi @Eric_Ouellette2 ,

I checked and couldn’t find ‘Vendor Collection Image’. And Shopify doesn’t support this, can you explain more about it and how it shows on the collection page?

Hi @LitExtension ,

I’ve made a collection for each vendor and add a feature image to each of these collections and in my code I added

{%- if product.vendor -%}

{% if collection.image %}{% endif %}

{%- endif -%}

But it only works if I access the product from the vendor collection, for example, the image did not appear if I access the product directly like in the following URL: https://ericsplugins.com/products/[product-name]/ but it appears if I access the product from the vendor collection like in the following URL: https://ericsplugins.com/collections/[vendor-name]/products/[product-name]/

Note that it did not work either if I access the product from another collection than the vendor collection.

The goal is that the image appears every time I access the product, even though it is directly or from another collection.

I hope it’s clearer

Thank you

Eric

Hi @Eric_Ouellette2 ,

Yes, the collection variable only works on the product page when it has the following link: https://ericsplugins.com/collections/[vendor-name]/products/[product-name]/

So if you want to display this image you need to change the code.

First, you go to the product page and add a tag to it with the structure: vendor_handle , with handle is collection handle of vendor collection.

Next, you change the code as follows:

{% assign handle_collection = product.tags| where:'vendor_' | first | remove:'vendor_' %}
{%- if product.vendor -%}
  
  	{% if collections[handle_collection].image %}{% endif %}
  
{%- endif -%}

Hope it helps!

Hi @LitExtension ,

I’m not sure to understand what you mean for the tag

Where exactly do I need to add a tag and is the tag “vendor_handle” ?

I’ve add “vendor_handle” as tag in a product itself in the Tags field and change the code but it still don’t work.

Looking at answer, you seem to think that I have only one vendor collection but I have a collection for each vendor and each of these collections have an image.

Thank you

Eric

Thank you

Eric

Hi @LitExtension ,

I just understand what you mean by vendor_handle structure, you mean “vendor_” and replace handle by the vendor collection handle.

It works now

Thank you

Eric