A space to discuss online store customization, theme development, and Liquid templating.
Hi Guys,
As shopify does not support China CDN anymore, we plan to build our own cdn for china customer as store the new image url in ProductImage metafield. However, when we tried to access the metafield in Liquid seems like it does not work. Is it possibly that Liquid does not have access to Product Image metafield? Because I am 100% sure that ProductImage has metafield and we have successfully added it.
Hi @Maacck ,
The thing is that the payload returned for a file/image metafield is a generic file object .
You can display an image by combining the Liquid code, an image_url filter and proper HTML <img> tag.
{{ product.metafields.namespace.key.value }}
{% assign image_url = product.metafields.namespace.key %}
{% if image_url != blank %}
<img src="{{ image_url.value | image_url }}">
{% endif %}
I was try to access the ProductImage's metafield instead of Product itself, and seems like is does not work.