How does one loop through metaobject metafields? If I know the specific key for a given field, I can access it directly, but it seems like it shouldn’t be difficult to loop through them all with a simple for iteration.
Example, this works as it should (metaobject is being accessed through a product metafield):
{% assign my_metaobject = product.metafields.custom.my_metaobject.value %}
{{ my_metaobject.a_known_key.value }}
I feel like something like the following should easily be possible, but I can’t figure it out:
{% assign my_metaobject = product.metafields.custom.my_metaobject.value %}
{% for unknown_field in my_metaobject.metafields %} //Loop over every metafield in the metaobject
{{ unknown_field.value }}
{% endfor %}
Any help would be great! Hard coding each metafield seems needlessly un-dynamic ![]()