Hello all,
I’d like to use a list and extract a value from a list metafield.
For now, I’m using the following metafields:
collection title1 (single-line text)
collection url1 (url)
collection title2 (single-line text)
collection url2 (single-line text)
…
In my product at the product metafield “test multi title” i have:
Cats & Dogs
Cat Breeds
But I’d like to use a collection metafield with a list of values (to retrieve the collection name). How can I retrieve a specific value from a list?
My code that I would like to make simpler is as follow:
{% if product.metafields.custom.test_collection_title != blank %}
{{ product.metafields.custom.test_collection_title1.value | link_to: product.metafields.custom.test_collection_url1.value }}
{{ divider_html }}
{{ product.metafields.custom.test_collection_title2.value | link_to: product.metafields.custom.unsen_collection_url2.value }}
{{ divider_html }}
{{ product.metafields.custom.test_collection_title3.value | link_to: product.metafields.custom.unsen_collection_url3.value }}
{%- endif -%}
Thank you!