Is it possible to create a set of metafields available in all pages, collections, products

Topic summary

Main issue: whether metafields can be defined once and automatically available across all page types (pages, products, collections, blog posts) via templates.

Key clarification: In Shopify, metafields are attached to resources (e.g., product, page, collection, shop) not to theme templates. Template-specific metafields aren’t supported; consistent data for a template must live in the template or shared snippets.

Alternatives suggested:

  • Use shop-level metafields for global data accessible everywhere (Liquid: shop.metafields.namespace.key).
  • Create a dedicated “data holder” Page (e.g., /pages/extrastuff) and reference its metafields (pages.handle.metafields.namespace.key).
  • Use page.content and theme snippets for sitewide content blocks.

Follow-up questions asked how to create metafields on the shop resource via Admin or REST API. Guidance provided:

  • Refer to Shopify docs on metafields and the Admin REST API example for creating a Shop metafield.
  • Consider using a metafields app if not working via API.

Outcome/status: Original question resolved with viable patterns; implementation details deferred to official documentation and apps. No code snippets beyond links; links are central to the guidance.

Summarized with AI on January 14. AI used: gpt-5.

Hi everybody,

Perhaps a silly question (new to Shopify). I wonder if there’s a way to create a set of metafields available in every page (ideally also blog post, product, collection page, etc…)

So if currently when you open a page (in edit view) you can see: Title, Content, SEO fields (title, desc, url handler), and an option to select a template.
And when you create metafields they seem to be attached to/available on THIS PAGE only.

I would like to have metafields that are attached to a template. So if ANY page selects a template it comes with a set of ready to use metafields.
The benefit is obvious - you can use the same template for many pages while keeping content and code separately.
Also you can create sitewide content blocks that can be included on various pages.

to be clear: “pages” - any store page that a user can access in browser (regardless of a page type “product, collection, page, blog, or whatever”).

Is it possible? Please clarify :slightly_smiling_face:

1 Like

This would be extremely helpful.

@d4m , @dkarr

Yes put it on the shop object

If it needs to be some global contrivance put it on the shop {{ shop.metafields.custom.key }}, if it’s a resource you can make some named /page in the admin that’s no more than a glorified data holder i.e. /pages/extrastuff then reference that {{ pages.extrastuff.metafields.custom.key }}

And when you create metafields they seem to be attached to/available on THIS PAGE only.

Yes the values of the metafield are per resource

I would like to have metafields that are attached to a template. So if ANY page selects a template it comes with a set of ready to use metafields.

Metafields go to resources not theme assets.

If you need metafields, or other data, consistently part of a template just put them in the template.

The benefit is obvious - you can use the same template for many pages while keeping content and code separately.

But you haven’t really as you still must reference any “global” metafields in code which is little more than storing static strings indirectly.

Also you can create sitewide content blocks that can be included on various pages.

You can already do this with page.content or theme snippets

https://shopify.dev/api/liquid/objects#pages

1 Like

Thank you, @PaulNewton . This is clear!
I have figured out myself too… this was a question of a total newbie who came from another cms world. In my favorite MODX templates are a different kind of enemy than in Shopify. But, well, you just accept it and move on :slightly_smiling_face:

apologies for picking up an old thread, but i’m trying to create a metafield against the shop object. I can’t for the life of me figure out how to do that, either through rest API or via the shopify admin console. Any advice how to create a metafield against the shop ? Many thanks!

1 Like

Same, have you figured it out?

Start here https://shopify.dev/docs/apps/custom-data/metafields

Direct example of creating a shop metafield:

https://shopify.dev/docs/api/admin-rest/2023-01/resources/metafield#:~:text=Create%20a%20metafield%20for%20the%20Shop%20resource

Otherwise use a metafields app.

1 Like