In our store we are using the Recharge App, which dynamically generates the products on a grid.
The only option I have to visually modify the page is to create HTML elements and append them to the corresponding element.
The way I do this is in the JavaScript tags in the Recharge liquid file {% javascript %}.
Now I want to use the metafields of the products to insert the value of the metafield under the picture of the product.
I tried to assign a test variable in Liquid:
{% assign testText = "New!" %}
outside of the {% javascript %} tags and then to retrieve it inside the{% javascript %} tags. But it’s impossible to make it show up.
I also tried every possible solution out there:
var myVar = {{testText | json}};
var myVar = {{testText }};
var myVar = "{{testText | json}}";
var myVar = "{{testText }}";
and then adding it to an innerHTML.
I would like to know if this is even possible? If yes, how would I proceed?
Thank you in advance.