Reputation: 36638
I have a product page in my store. All my products have an associated vendor. For each vendor, I have a custom Shopify page and on this page is attached several metafields. Metafields include things like the vendor (company) country, year founded, etc...
On my product page, I would like to show the above info about the vendor. I can get to the metafields for the vendor if I was on the custom vendor page by using something like:
{% assign vendor_country = page.metafields.mynamespace.country %}
Is there anyway to get the same metafield info if I was on a product page? In this case, the context of the Liquid page
variable would not be correct by default. I need a way to set this context based on the product.vendor
variable and then request the custom vendor page data.
Upvotes: 2
Views: 7246
Reputation: 4930
This is possible if you know the page handle. To do so you will have to make use of pages global object. So just get a page by handle and then call the metafields.
Example Code in Product template
{{ pages['page-handle'].metafields.namespace.fieldName }}
Upvotes: 7