Skip to main content

Overview

Layers metaobjects and metafields are accessible in your Shopify theme via Liquid, allowing you to build custom sort order selectors, facet filters, and recommendation blocks without JavaScript. All Layers metaobjects have public storefront access, making them available in any Liquid template.

Namespace reference

Layers uses the following namespaces for metaobjects:

Accessing sort orders

Sort order metaobjects represent the sort orders configured in your Layers dashboard.

Basic access

Available fields

Filtering by scope

Display only sort orders available for specific contexts:

Ordering by display order

Using collection default sort order

Access the default sort order assigned to a collection:

Accessing facets

Facet metaobjects represent filterable attributes configured in Layers.

Basic access

Available fields

Building a facet filter UI

Facet metaobjects only provide the facet configuration (name and code). Actual facet values and counts must be fetched from the Layers Browse API.

Accessing blocks

Block metaobjects represent recommendation blocks configured in Layers.

Basic access

Available fields

Filtering by anchor type

Display blocks based on the current page context:

Accessing app configuration

Access Layers configuration data stored on the app installation.

Embed settings

Available fields

Best practices

Performance

  • Cache metaobject queries when possible using Liquid variables
  • Minimize the number of metaobject iterations in your templates
  • Use JavaScript to fetch dynamic data (facet values, recommendations) rather than making multiple Liquid queries

Error handling

Always check if metaobjects exist before accessing them:

Namespace consistency

Use the exact namespace values provided in this documentation. The namespace includes the Layers app ID and must match exactly:
Always use the full namespace (app--278936322049--<type>) when accessing Layers metaobjects via Liquid. Short forms or aliases will not resolve.

Troubleshooting

Metaobjects not appearing

If metaobjects are not accessible in Liquid:
  1. Verify the sort order has Enable as Storefront Sort enabled in Layers
  2. Verify the facet has Enable as Storefront Facet enabled in Layers
  3. Check that the metaobject was created (visible in Shopify admin under Content → Metaobjects)
  4. Ensure you’re using the correct namespace

Empty values

If metaobject fields return empty values:
  1. Verify the field exists in the Layers dashboard
  2. Check that the metaobject has been synced (may take a few seconds after creation)
  3. Use .value to access field values: {{ sort_order.name.value }}

Collection default sort order not found

If the collection’s default sort order is not accessible:
  1. Verify a default sort order is assigned in Shopify admin (Products → Collections → [Collection] → Metafields)
  2. Check that the referenced sort order still exists in Layers
  3. Ensure you’re using the correct metafield namespace

See also