August 10th, 2022
When setting a metafield to a type “variant” you would be forgiven for thinking it would return a product object when accessed.
Unfortunately, this is Shopify so it returns a String GID.
It took me much longer than I would like to admit to figure this out. It was the reason I couldn’t access any of the variant variables.
To access the object replace:
card_product: product.metafields.namespace.real_variant
with
card_product: product.metafields.namespace.real_variant.value
Appending .value loads the object rather than returning shopify’s gid:// string.