sadly I’m not able to get this simple piece of code running:
{% for field in product.metafields.custom.anleitung %}
{{ field | first }}: {{ field | last }}
{% endfor %}
I have three files in a file – list metafield and simply want them to get displayed on my site. (number of files varies)
2
Answers
See Accessing metafields of type list for the syntax to loop over list values.
Instead of
field.url
, you can usemetafield_text
filter:<a href="{{ field | metafield_text }}">Anleitung downloaden</a>
.Or, you can use
metafield_tag
and rely on Shopify to generate the link:{{ field | metafield_tag }}
For anyone else having trouble getting this to work with multiple pdfs/files, I have a working solution: