I’m unable to display the featured image for the metaobject fields corresponding to either single product or single variant. However, I can successfully retrieve the featured images from the list versions of both product and variant fields. Here’s the working loop for the list version:
{% for addon in shop.metaobjects.addons.values %}
{% for product in addon.test.value %}
{{ product.featured_image | img_tag }}
{% endfor %}
{% endfor %}
In contrast, the loop for the single version is not functioning:
{% for addon in shop.metaobjects.addons.values %}
{% for product in addon.variant.value %}
{{ product.featured_image | img_tag -}}
{% endfor %}
{% endfor %}
For context, here is an example of the metaobject illustrating the Name key for the fields:
.
And here’s a populated example of the metaobject:
.
I’m expecting to get the featured image instead of a “no image” image.