how to Use Metafiled in Jquery like using .html({{current_variant.metafields.my_fields.pack_size_m2_}}); but not working

142
March 13, 2022, at 8:00 PM

Hi there i want to know how to embbed Shopify Metafield in Jquery like in want to do this

$(selectors.vareintMeta, this.$container)
.html("{{variant.metafields.my_fields.pack_size_m2_}}");

Its Printing {{variant.metafields.my_fields.pack_size_m2_}}

but it should print values in this metafield like 20 or 30 or so on

Answer 1

Your file needs to be .liquid to be able to use liquid code.

Rent Charter Buses Company
READ ALSO
Lightslider not working on the server but works locally on my machine

Lightslider not working on the server but works locally on my machine

apologies if this seems like a noob question but I've been struggling to get my slider work on the server just like it does locallyIts tough to find the exact problem as there are no error logs on the console

95
Nested append in javascript

Nested append in javascript

I want to wrap both select and button under one div <div class="row">I have the below code working but unable to wrap it

134
Is there a way to show an element if it has all of the classes matched from an array that is consistently having variables pushed in and out of it?

Is there a way to show an element if it has all of the classes matched from an array that is consistently having variables pushed in and out of it?

I'm creating a sorting program for DnD spells that sorts all 318 spells into 83 different categoriesI have multiple arrays storing all of the information, and I know how to check if an element has a class from an array

155
How can I include the 0 within the results in this canonical search form?

How can I include the 0 within the results in this canonical search form?

I have a lottery search form which concatenate six input fields into a single value and returns the results based on the positionMy form works correctly for numbers 1-9, but it is unable to display results when I search for 0

121