Overview
Layers metaobjects and metafields are accessible in your Shopify theme via Liquid. Use them to render the structure of custom sort order selectors, facet filters, and recommendation blocks (names, codes, and settings) server-side, without JavaScript. The live data that fills them, such as facet values and counts or the products in a recommendation block, comes from the Layers APIs, so you still need JavaScript (or the SDK) to fetch it. All Layers metaobjects have public storefront access, so they are 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, counts, and numeric ranges must be fetched with JavaScript from the Facets API. Browse responses include the same
facets and facetRanges fields. See Rendering facets in Liquid.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
The Layers theme app embed writes your storefront configuration into every page as a JSON script tag in the<head>. This tag is the recommended source, so you don’t need to read metafields to get it:
Available fields
Reading the tokens in Liquid
If you need the tokens server-side in Liquid instead, Layers also writes them to shop metafields:
If these metafields are empty on an older installation, trigger a resync from Settings → Integrations in the Layers dashboard. See Collection & app metafields.
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:- Verify the sort order has Enable as Storefront Sort enabled in Layers
- Verify the facet has Enable as Storefront Facet enabled in Layers
- Check that the metaobject was created (visible in Shopify admin under Content → Metaobjects)
- Ensure you’re using the correct namespace
Empty values
If metaobject fields return empty values:- Verify the field exists in the Layers dashboard
- Check that the metaobject has been synced (may take a few seconds after creation)
- Use
.valueto access field values:{{ sort_order.name.value }}
Collection default sort order not found
If the collection’s default sort order is not accessible:- Verify a default sort order is assigned in the Shopify admin (Products → Collections → [Collection] → Metafields) or on the collection’s page in the Layers dashboard
- Check that the referenced sort order still exists in Layers
- Ensure you’re using the correct metafield namespace
See also
- Metaobjects & Metafields — Complete reference for Layers metaobjects
- SDK Reference — JavaScript SDK for Layers integration
- Browse API — Fetch products with sorting and filtering
- Blocks API — Fetch recommendation blocks