All things Shopify and commerce
Hi guys, I'm facing a problem, please let me know if you've any solution for this. I've created a metaobject with the two values : one is list of files and second list of single line text, and attached it in a product metafield. now when I want to address those values in liquid as currently I'm easily able to address fields with single value but when it comes to multiple values(list of values) it's creating a problem. It's printing nothing when I'm addressing the multiple values field. {% assign prdata = product.metafields.custom.colourvariants.value %} {% assign prdataImg = product.metafields.custom.colourvariants.value.img %} <img src="{{ prdata.secimg | image_url }}" width="30" height="30"> {{ prdataImg }} {{ prdata.secimg }} here is the reference code, in the above code prdataImg contains list of files which is not printing anything and below you can see {{ prdata.secimg }} is a single value field and its visible {{ prdata }} is returning MetaObjectDrop I tried to take ChatGPT help, it also didn't worked out.
Hey @Kushagra0602
Please try this.
{% assign prdata = product.metafields.custom.colourvariants.value %}
{% for item in prdata %}
<img src="{{ item.img | image_url }}" width="30" height="30">
{{ item.text }}
{% endfor %}
Didn't work, .img is a list of images and that's where I'm stuck, it's working prefectly with the single value. I tried to loop it also.
Sorry to know that it not worked,
{% assign prdata = product.metafields.custom.colourvariants.value | json %}
{% for item in prdata %}
<img src="{{ item.img | image_url }}" width="30" height="30">
{{ item.text }}
{% endfor %}
In this tried JSON
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024