Variant metafields are not showing although it has been implemented in the code

New Member
5 0 0

Hello! In my code I have implemented the products metafields and product variant metafields. The default product metafields is working nicely. I also manage to display the variants by adding lines to the coding. But right now it is showing the variant metafields of all the variants at the same time, while it should only be showing the metafields of the variant that is selected. I am not that experienced in coding. Maybe someone can help me? Best Regards, Dionne




<div class="Shopify-product-details__short-description">
<p class="p_des_ex mg__0">
{%- if product.metafields.details.color != blank -%}                       
{% endif %} 

{% for variant in product.variants %}
<td>{{ variant.metafields.details.color}}</td>
{% endfor %}