Unleash hidden Shopify superpowers with product metafields
Product metafields add structured, custom details to products and variants—think Material, Care, Spiciness, or Ingredients—and let you display them on product pages and power smarter filters. This guide stays practical: we’ll create metafields, populate them, display them via dynamic sources, and enable storefront filtering with the Search & Discovery app.
What are product metafields?
Product metafields are custom fields you define for products (and variants). Each metafield has a namespace and key (its address), a type (text, number, file, boolean, list, etc.), and optional validation rules. They give you a clean, repeatable way to store extra product facts without bloating descriptions.
Image: A product with product details specifications showing example metafields Material, Product Care, Age Range, and Weight.
Step‑by‑step: add, populate, and display
1) Create product or variant metafield definitions
- Admin → Settings → Metafields and metaobjects → choose Products or Variants.
- Click Add definition.
- Name: Material (example)
-
Namespace and key:
specs.material
(keep names clear; lowercase; use dots/underscores) - Type: Single line text (or appropriate type)
- Validation (optional): e.g., set a list of allowed materials
2) Add values on products/variants
Open a product → scroll to Product metafields (or open a variant for variant metafields) → fill in values (e.g., "Organic Cotton"). Save.
3) Display on the product page (no code)
- Online Store → Themes → Customise → navigate to a product template.
- Add a block (Rich text/Collapsible content) and click Connect dynamic source (cylinder icon).
- Pick Product → Metafields → Material (your definition). Save.
Tip: For tables of specs, repeat with multiple metafields (Material, Care, Dimensions). For advanced layouts, use a Custom Liquid block to format values.
4) Use metafields for storefront filters
- Install/enable the Search & Discovery app by (Shopify).
- Open App → Filters → Add filter → choose your metafield (e.g., specs.material).
- Publish. Customers can now filter collections by your custom criteria.
FAQs (quick)
Do I need to code to use metafields?
No. You can create definitions in Settings and bind them in the Theme editor using dynamic sources. Code is only needed for complex layouts.
Bind responsibly: prefer a few well‑named fields over dozens, and set validation where helpful.
Will metafields slow down my store?
The fields themselves are lightweight. Performance issues usually come from heavy layouts or loading lots of values per product.
Stay consistent: agree naming conventions and review definitions quarterly.
Metafields vs tags?
Tags are broad labels for grouping/search. Metafields are structured product facts you can display and filter on.
Best practice
-
Naming: group related fields by namespace (e.g.,
specs.*
). - Validation: restrict to allowed values where possible.
- Bulk edit: export/import CSVs or use bulk editors/apps for large catalogues.
- Fallbacks: hide blocks when values are blank to avoid empty labels.
Glossary
Metafield
A custom field you define on products or variants (namespace.key + type + value).
Variant metafield
A metafield attached to a specific variant (e.g., size‑specific measurements).
Dynamic source
Theme editor feature that binds a field (like a metafield) to a section/block.