Why isn't my collection image metafield displaying on the home page?

Hello,

I have created a collection Image metafield. On collection page when I call it works fine. But i have created a block section for home same like Featured collection and in snippet when I tried to call it its not coming and showing noimage URL.

@Shail_92

Sorry you are facing this issue, it would be my pleasure to help you.

Welcome to the Shopify community! :blush:
Thanks for your good question.

Please share your site URL,
I will check out the issue and provide you a solution here.

@KetanKumar

Thanks for the reply.

The site link is https://www.ecorus.com.au/

The code this <img src=“{{collection.metafields.my_fields.custom_image | img_url:‘300x’}}” when I use it in collection.liquid it woks fine.

but in the snippet custom liquid file when I use this code it shows no image.

Can you please guide me on this?

Hi @Shail_92 ,

To my understanding, the “collection.liquid” file represents the collection page template. When editing the code in this file, you can access the data from the collection object directly. However, it seems like you can’t do that in your custom code snippet. Seems like you need to figure out the way to access the collection object from that file and it would do the trick.

@Shail_92

thanks for all details i have check its working fine

@MetafieldsGuru

Yes, you are correct I made that mistake to get the collection object in my Snippet. I created that and it’s working fine now.

Thanks for the help

@KetanKumar

Yes, I got my mistake and was able to solve that.

Thanks for the help