What's your biggest current challenge? Have your say in Community Polls along the right column.

Re: Retrive Variant Metafields data for each Variant

Retrive Variant Metafields data for each Variant

praveen995
Shopify Partner
5 0 0

Screenshot 2023-06-12 172732.png

 

<div class="product_additional_information mb-30 mt-10">
<p><span class="font-body-bold">Voltage:</span>
{{ variant.metafields.custom.product_voltage }}</p>
</div>

 

I am trying to retrieve the product variant metafield value with the above code, but I don't get any value its empty.

Replies 3 (3)

JHKCreate
Shopify Partner
3571 638 931

Hi @praveen995 


The variant variable needs to be assigned before you can retrieve the value. You then loop the variants and the information will show.

 

Check in your product template where the for loop is that goes through product variants, then add the code for the metafield inside of it, it'll work directly.

 

Let us know if you require additional assistance!

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com
praveen995
Shopify Partner
5 0 0

Hi @JHKCreate , can you send or attach any reference, so that I can understand it more clear. That would be helpful.

JHKCreate
Shopify Partner
3571 638 931

Here's the link for the product object: https://shopify.dev/docs/api/liquid/objects/product

Did we solve your issue? Like & Mark As Solution to help the community
Should you need any direct help: contact@jhkcreate.com

Learn more about us: jhkcreate.com