How do I display variant metafield next to product sizes?

How do I display variant metafield next to product sizes?

jw8
Tourist
6 0 0

Hey! I'm looking for feedback & possible help for a project I'm working on. I'm trying to show variant metafield next to sizes. Here's the code I'm working on at the moment:

 

 

{%- if product.type == 'Cyklar' -%}
    <div class="storlekstext">Passar längd: 
        <span>{{ variant.metafields.custom.langd.storleksguide_cyklar[0] }} - {{ variant.metafields.custom.langd.storleksguide_cyklar.value.last }}</span>
    cm </div>
{% endif %}

 

 

Here's my metafield
Name: storleksguide cyklar
Namespace and key: custom.langd
Single line text
List of values

custom.langd.png


Since its a list of values I use "[0]" to get the first value and ".last" to get the last value. Final text should be something like "Passar längd: 170-185 cm" where 170 and 185 is values from the variant metafield.

Replies 0 (0)