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
User | RANK |
---|---|
42 | |
42 | |
32 | |
24 | |
20 |
Make the shift from discounts to donations, and witness your business not only thrive fina...
By Holly Dec 4, 2023On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023