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

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 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.display_name
  • metafields.custom.specification.fields.material
  • metafields.custom.specification.fields.finish
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:
The base metafield code (e.g., metafields.custom.specification) is not available as an attribute for reference-type metafields. You must use one of the nested paths listed above. Transport-only paths such as __typename, .type, and .handle on nested references are also 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