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] %}
{% 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..