Can I use liquid inside JS file?


Ask A Question





Login To post a question

I’m using Shopify and I need to show some message if specific product tag is exist. I need to check for product tags from JS file and need to know how can I do that.

I tried to use {{product.tags}} in the js file but I got an error, I also tried that in .js.liquid file and it still throw an error.

{% assign clearance = false %}
    {% for tag in product.tags %}
            {% if tag contains 'Clearance' %}
                 {% assign clearance = true %}
            {% endif %}
   {% endfor %}

There is a way that I could use that in js? If not, how can I grab all product tags in js way? I know I can do that from liquid file but I have to do that only in the js file.

For more info please click herehttps://stackoverflow.com/q/57635860



Have a question or need a custom quote?
info@smartinfocare.com