Erodad
1
Hey guys and girls,
I am trying to read the metafields of a product that is referenced in a LineItem but it does not work.
What I am trying to do:
{{ line_item.product.metafields.global.id }}
But that doesnt work and the metafield does exist 100%!
Is it possible to somehow read the metafields of a product that is referenced in a LineItem?
Thanks for your help
Are you sure a metafield with the key “id” exists? If I recall correctly, Shopify require metafield keys to be at least 3 characters long…
To debug it, put this in your template temporarily to see what metafields are available :
{% for field in line_item.product.metafields.global %}
--
Key: {{ field | first }}
Value: {{ field | last }}
--
{% endfor %}
…and then check your source code in the browser. Do you get anything back?
Cheers, Andrew.