How do I display product dimensions using metafields?

Hi all,

I am attempting to use the built-in metafields to populate my product dimensions.

I have metafields defined, and cannot get them to display.

my code:


Bridge Width: { product.metafields.my_fields.bridge-w }}mm

Thanks for any help!

Hi @Devin_Swisher ,

You have a syntax error, please try this code again:


Bridge Width: {{ product.metafields.my_fields.bridge-w }}mm

If you find this answer helpful, please mark it as a SOLUTION.

Best regards.

1 Like

Hey @Devin_Swisher

You have one missing curly braces due to which you are not able to view the correct output

Bridge Width: {{ product.metafields.my_fields.bridge-w }}mm

Apart from the missing curly brace, pay attention to the “Namespace and key” field – that’s what you should use in code.

You’re trying to use

product.metafields.my_fields.bridge-w

but you should use

product.metafields.my_fields.bridge_w

Hi @Devin_Swisher

There are multiple issues in the original code:

  1. a missing opening “{” symbol;

  2. a misspelled metafield key (it says “bridge-w” and not “bridge_w”);

  3. a missing “.value” part of the Liquid code right after the metafield key (which is required when dealing with an OS 2.0 metafield type).

You may want to try this:


Bridge Width: {{ product.metafields.my_fields.bridge_w.value }}mm

1 Like

Thanks so much!