Skip to main content
Metafields extend products with custom structured data. Layers supports the standard Shopify metafield types and provides predictable access patterns for using metafield values as searchable, filterable, and sortable attributes. This page covers the core metafield contract. See these related pages for deeper topics:

Supported metafield types

The product schema supports various Shopify metafield data types, ensuring that your product data is handled correctly for display and filtering purposes. The following metafield types are currently supported: These metafield types allow for greater flexibility and precision when configuring and displaying product data within your search and browse engine. For a complete list of supported metafield types and their properties, refer to the official Shopify Metafield Data Types documentation.

Metafield structure and examples

Metafields are organized by namespace and key in a nested object structure. The namespace groups related metafields together, and each key within a namespace contains the metafield value.

Metafield structure

Example: custom product metafields

Accessing metafields in attributes

To create a catalog attribute from a metafield, use dot notation with the full path:

Accessing nested metafield object keys

When a metafield value is a JSON object, you can create attributes that access nested object keys using dot notation. The namespace and key portions must follow standard naming conventions (alphanumeric and underscores), but object keys can contain spaces and special characters. Format: metafields.{namespace}.{key}.{object_key} Example metafield value:
Attribute codes for nested object keys: Use cases:
  • Filtering: Create filterable attributes for nested metafield values to enable faceted navigation (e.g., filter by color family values)
  • Faceting: Display facet counts for nested object values in browse and search results
  • Sorting: Sort products by nested metafield object values
  • Merchandising: Use nested metafield values in collection rules and merchandising logic
This feature supports both metafields and variant_metafields with the same syntax. Variant metafield example: variant_metafields.custom.size_details.extra large

Structured metafield subfield leaves

Shopify’s structured metafield types (money, weight, volume, dimension, and rating, plus their list.* variants) decode into JSON objects, not scalars. The parent attribute code is not directly filterable or sortable. You address the scalar leaves inside the object instead. Layers indexes numeric leaves with numeric semantics, so filters and sort orders compare 19.90 < 100.00 correctly. Without this, string ordering would put "100.00" before "19.90". The available leaves per type: Example: a custom.price money metafield exposes these attribute codes:
  • metafields.custom.price.amount: numeric. Use for range filters and sort orders.
  • metafields.custom.price.currency_code: string. Use as a facet.
Filter by amount on a Search or Browse request:
Sort by amount ascending:

Attribute paths for reference metafields

When a metafield is a reference type (such as metaobject_reference, file_reference, or taxonomy), Layers discovers curated nested attribute paths instead of the base metafield code. This gives you access to the specific values within the normalized reference structure that are useful for filtering, sorting, and display. See Metaobjects and reference metafields for the full normalized shapes and every supported attribute path. Metaobject reference attributes: For metaobject references, the available attribute paths target the base reference (the metaobject handle), the display name, and individual fields: Example: If you have a custom.specification metaobject reference with fields material and finish, Layers discovers these attribute codes:
  • metafields.custom.specification (the handle of the referenced specification metaobject)
  • metafields.custom.specification.display_name
  • metafields.custom.specification.fields.material
  • metafields.custom.specification.fields.finish
When you use the base metaobject-reference path (metafields.{namespace}.{key}) as a facet, filter UIs receive raw handles. Set enrichFacetMetaobjects to true on your facet, search, or browse request to also receive a facetDisplay map with each handle’s display_name and fields for labels and swatch data.
Media and file reference attributes: For image and file references, the available paths are: Taxonomy reference attributes: For taxonomy value references, the available path is:
For file_reference and taxonomy metafields, the base metafield code (for example, metafields.custom.hero_image) is not available as an attribute. Use one of the nested paths listed above instead. For metaobject references, the base code is available as a single-value handle attribute only when every reference targets one metaobject definition type. mixed_reference remains unavailable. Transport-only paths such as __typename, .type, and .handle on nested references are always excluded from attribute creation.

Example: list-type metafields

List metafields (e.g., list.single_line_text_field, list.product_reference) are stored as arrays:

See also