Shopify themes, liquid, logos, and UX
Hey all,
I'm trying to add a variant product metafield to this page, below the price but above the Quantity.
https://slowageing.co.uk/products/essential-bath-shower-essence?variant=40509019652279
I've tried adding this code to the right area, but it's not calling up the variant metafield, can anybody help me get it working?
<p> Size: {{variant.metafields.my_fields.size}} </p>
Thanks!
Dan
Update, I have managed to make the variant metafield display correctly with the following code:
<div><p><strong> {{ current_variant.metafields.my_fields.size }} </strong></p></div>
However, if the metafield is empty (which it will be for some products) a "0" is being displayed on the product page. Can anyone help me to stop the "0" from being displayed?
I found a solution in an article written by Alan Ryan here: https://alanryan.dev/tips/product-variant-metafields/. It works great!
User | RANK |
---|---|
227 | |
180 | |
63 | |
53 | |
47 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023