I am attempting to write a simple code that inputs the string from a Shopify variant metafield into a div.
The challenge is that I know how to call the data in liquid, but I cannot call the data in a JS format. Every time I try to put the data into the code via liquid it doesn't come back.
Here is the code:
$('.single-option-selector').on('change', function(){
let shipping_speed = {{ product.selected_or_first_available_variant.metafields.availability.type }}
$('div.product-availability strong').html(shipping_speed);
});
How does one convert the liquid variable into a string that can be used in a JS file?
let shipping_seed = "{{ product... }}";
– Rory McCrossan