Issue
I've just started working on customizing my Shopify template, but I've ran into a basic issue, where the docs didn't help.
<script>console.log("_{{ item.properties | join: ", " }}_");</script>
// prints "_foo1, foo2_"
<script>console.log("_{{ item.properties[0] }}_");</script>
// prints "__"
<script>console.log("_{{ item.properties }}_");</script>
// prints "_EscapedHashDrop_"
Thanks!
Solution
you are getting value in string in first console and try to fetch value as a array in second console so it's not possible
you have to convert your string value in array by using .split() function.
Try this code it will give result according to you.
var itemvalue = "_{{ item.properties | join: ", " }}_";
// console.log(itemvalue); ---> print "_foo1, foo2_"
var myvalue = itemvalue.split(",");
console.log(myvalue[0]);
Answered By - Dotsquares Answer Checked By - Pedro (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.