Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
How do i fetch the collection.metafields.custom.collection_images data in the main-collection-product-grid.liquid.
I tried to fetch it but getting ["gid://shopify/MediaImage/26512699457617","gid://shopify/MediaImage/26512699424849"] as output. I need to fetch the image url there.
Hello!
Sure, here’s a shorter version:
{% for id in collection.metafields.custom.collection_images %}
{% assign image = shop.media_by_id[id | split: '//' | last | split: '/' | last] %}
<img src="{{ image | img_url: '300x300' }}" alt="">
{% endfor %}
This will loop through the IDs and output the image URLs.
Best Regards,
this is not working.. its not entering inside the for loop as there is no id..
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025