Structuring Shopify Content: Metafields vs Metaobjects
Introduction
Hydrogen storefronts thrive on flexible content. Shopify provides two main tools for extending content beyond the catalog: metafields and metaobjects.
They sound similar β but they solve very different problems. This post breaks down when to use each, with patterns and practical GraphQL examples.
Metafields: Simple Extensions
- π§© Scalar values β string, integer, boolean, JSON.
- π Best for:
- PDP specs (materials, dimensions).
- Flags (is_featured, preorder).
- SEO overrides (meta_title, meta_description).
- β‘ Pros: lightweight, easy to query, inline with product data.
- β οΈ Cons: not great for structured or relational data.
Example Query (Metafield):
query ProductWithSpecs($handle: String!) { product(handle: $handle) { title metafield(namespace: "specs", key: "material") { value } } }
Metaobjects: Structured Blocks
- π¦ Structured, relational content.
- π οΈ Best for:
- Editorial blocks (lookbooks, FAQs).
- Relational joins (recipes β ingredients).
- Reusable content types (author bios, landing page sections).
- β‘ Pros: flexible schema, reusability, CMS-like power.
- β οΈ Cons: more complex queries, heavier schema management.
Example Query (Metaobject):
query EditorialBlock($handle: String!) { metaobject(handle: {type: "lookbook", handle: $handle}) { fields { key value } } }
When to Use Each
| Use Case | Metafield β | Metaobject β |
| PDP specs (size, weight) | β | β |
| Preorder flag | β | β |
| SEO meta_title override | β | β |
| FAQ block | β | β |
| Recipe + ingredients | β | β |
| Landing page hero | β | β |
π Metafields = simple data. Metaobjects = structured content.
Hybrid Patterns
- Metafields for PDPs β small flags, details.
- Metaobjects for CMS β editorial, marketing, relational.
- Load both into Hydrogen loaders β shape content dynamically.
Case Example: Lifestyle Brand
- Started with metafields for product details.
- Marketing team wanted rich editorial blocks.
- Migrated editorial β metaobjects (lookbooks, FAQs).
- Result: faster iteration, less developer bottleneck.
Guardrails
- β Donβt overload metafields with JSON blobs β use metaobjects.
- β Reserve metafields for product-specific content.
- β Document metaobject schemas with marketing team.
- β Cache queries smartly β metaobjects can be heavier.
Conclusion
Metafields and metaobjects arenβt interchangeable β theyβre complementary. Use metafields for lightweight PDP details and flags, and metaobjects for structured, CMS-style content.
Think of metafields as notes in the margins, and metaobjects as chapters in the book.