0

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!

1 Answer 1

0

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]);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.