Can't access my variant metafields

8 0 0

I am mystified. I have added a metafield to all my product variants called fabric_content.










I can see my variant when I run this code.



{%assign current_variant = product.selected_or_first_available_variant%}




But when I try to view the actual metafield attached to that variant nothing shows up.






It works find if I try to access metafields on a product. Just not on the product variant. 

I've tried changing the metafield name and still nothing. 

Any suggestions of what I could be doing wrong? 

Shopify Expert
10402 163 2045

This is an accepted solution.

In your code you are assigning a variant to this var:


and then you are referencing the second option in that variant. 


More info on option2 in here:

But metafields are not attached to options, like option2. They are attached to objects like products or variants. 

So more like this:

{{ current_variant.metafields.description.fabric_content }}


I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.

★ ★