Product level metafield call to custom page?

Topic summary

Accessing product-level metafields on a custom (non-product) page in a Shopify theme.

  • Current state: The author can retrieve product metafields only on the product detail page.
  • Goal: Read the same product-level metafield values on a custom page (non-product template).
  • Clarification: Metafields are custom data fields attached to products, used to store additional structured information.
  • Ask: Guidance on the correct approach to reference a product’s metafields from a custom page/template.
  • Status: No solutions or workarounds provided yet; the question remains open with no confirmed approach shared.
Summarized with AI on January 9. AI used: gpt-5.

Hello,

I hope you are doing well.

I have a question regarding accessing product-level metafield values on a custom page. Currently, I am able to retrieve product metafields only on the product detail page. However, I need to access the same metafield values on a custom page (non-product template), and I am unable to do so.

Could you please advise on the correct approach to retrieve product metafield values on a custom page?

Thank you in advance for your assistance.

How are you trying to do that?

On a product page template there is a predefined global variable product which you can refer to either from Liquid code or use in dynamic source.

On a page you’d need to use a different reference.

And it may also depends on the theme code.

For example, you can use
all_products["product-handle"].metafields.namespace.key.value to fetch a product metafield knowing its handle from Liquid code.

2 Likes

Hi,

Hope this will help

Product metafields are only available when a product object exists and on a custom page there is no product context by default.

Correct and safe ways to approach is:

Option 1: Load a specific product on custom page
Option 2: Pass the product via URL
Option 3: Use a product reference metafield on the page

The most flexible approach for custom pages is to use a Product Setting in your section schema. This allows you to select a product in the Theme Editor and then access its metafields like this:

{{ section.settings.product_info.metafields.namespace.key }}

This ensures the page remains dynamic without hardcoding handles into your Liquid files.