How can I display related products on my product page using metafields?

I have created a related product with the new Shopify 2.0 metafields.

My question is how do I add/print these related products on my product page?

Thanks in advance.

Hi @noovo ,

If you have added the meta field as type product_reference, you can access the product object from the meta field like this:

{{ resource.metafields.namespace.key.value }}

See here

Once you have access to the product object you can output the product info on the page see https://shopify.dev/api/liquid/objects/product.

{{ resource.metafields.namespace.key.value.title }}

@hasanarmstrong my namespace and key is

my_fields.related_product_one

I have tried add the code you gave but nothing shows.

I’ve tried this and it doesn’t seem to work. The product_reference is working, but I don’t have access to the product object.