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

Highlighted
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">
								                     
<h4>Specifications</h4>  
{%- if product.metafields.details.color != blank -%}                       
<tr>
<strong><td>Color:</td></strong>
<td>{{product.metafields.details.color}}</td>
<tr>
{% endif %} 

{% for variant in product.variants %}
<tr>
<strong><td>Color:</td></strong>
<td>{{ variant.metafields.details.color}}</td>
<tr>
{% endfor %}                      
</p>
</div> 

 

 

 

0 Likes