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 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.
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
There are multiple issues in the original code:
a missing opening “{” symbol;
a misspelled metafield key (it says “bridge-w” and not “bridge_w”);
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
Thanks so much!