Discussion
Shopify
How do I access Metafields in a .js file for my custom section?
Tom Security
0 reputation
2 months ago
132 views
3 replies
Been struggling with this for a bit. Any suggestions?
Question: How do I access Metafields in a .js file for my custom section?
Question: How do I access Metafields in a .js file for my custom section?
2 Replies
Jake Project
· 2 months ago
Assign the metafield to a JavaScript variable inside a `<script>` tag in your liquid section file: `const metaValue = {{ product.metafields.custom.data | json }};`.
You must be logged in to reply.
Log In to ReplyRelated Discussions
Liquid Error: 'Memory limits exceeded' in collection.liquid loop. How to optimize?
3 replies
1 month ago
Why is 'img_url' filter deprecation warning showing up in my theme editor?
3 replies
1 month ago
How to filter a collection by tag using URL parameters without an app?
3 replies
1 month ago
How to show different content for logged-in customers vs guests?
3 replies
1 month ago
Implementing 'Add to Cart' via AJAX. Getting 422 Unprocessable Entity.
3 replies
1 month ago