Hi,
We use dimension metafields for clothing measurements. We do this primarily in inches or CM but want to be able to provide both units to the customer without having to use two metafields.
To do this I want to be able to access the Unit of the metafield so that I can then write a translation between the two. Doing the translation will be fairly straightforward as its just a calculation, but I’m having trouble even accessing the unit.
Here you can see I have chest measurement (in INCHES) and inside leg (in CM)
The code used to output this is
CHEST: {{ product.metafields.prods.chest }}
{% if product.metafields.prods.chest.unit == "cm" %}
this is a CM measurement
{% else %}
this is NOT a Cm measurement
{% endif %}
INSIDE LEG: {{ product.metafields.prods.inside_leg }}
{% if product.metafields.prods.inside_leg.unit == "cm" %}
this is a CM measurement
{% else %}
this is NOT a Cm measurement
{% endif %}
I would expect to see the inside leg value evaluate as true because the unit is “cm” but it doesn’t.
Does anyone know how you can access and run checks against what the unit within a dimension metafield is?
Many thanks
