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..
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024