How can I display the correct metafield for each product variant?

I have variant metafield that I’m trying to show on product page next to the variant option. Problem is that it currently shows all variant metafields on all variant options. I don’t know how to only show the correct metafield on the correct variant.

Here’s my code.

{%- if product.type == 'Cyklar' -%}
  {% for variant in product.variants %}
     Passar längd: {{ variant.metafields.custom.langd.value.first }} - {{ variant.metafields.custom.langd.value.last }} cm

  {% endfor %}
{%- endif -%}

Hey @jw8 ,

Seems you have json type metafield because custom metafield named as variant.metafields.custom.langd but your metafield name is variant.metafields.custom.langd.value.first

It will be best you could share full structure of your metafield or metafield screenshot, so that we could provide you working solution.