Shopify Metafield List of Collections

I need to get the list of images from my metafield(content type: collection list) in collection. I'm using this logic but it is not working... Code snippet {% assign top_collections = collection.metafields.custom.c-top-collections %} {% if top_collections %} <ul> {% for collection in top_collections %} <li>{{ collection.value }}</li> {% endfor %} </ul> {% endif %} Please, what is the correct form of doing this? Thank you.

Comment (2)

Jese Leos

August 19, 2024

Verified user

To get your array you need to write this {{ collection.metafields.custom.c-top-collections.value }}

Jese Leos

August 19, 2024

Verified user

Example solution here with some variables being pulled: {% assign collection-list = collection.metafields.menu.c-top-collections %} {% for collection-list-item in collection-list.value -%} {% if collection-list != blank %} <img class="rounded-full h-28 w-28 object-cover object-center aspect-square " src="{{ collection-list-item | image_url }}" alt="{{ collection-list-item.image.alt }}"/> <h2 class="text-xl mt-4 text-center">{{ collection-list-item.title }}</h2> {% endif %} {% endfor %}

You’ll be in good company