metaobjects
metaobjects is a bounded lookup of storefront-exposed metaobject types:
{% assign materials = metaobjects['material'] %}Malformed and app-owned app-- type keys return nil. Any other syntactically
valid type key returns a bounded definition container; a missing/private type
therefore has an empty values list and zero count, while entry-handle lookups
return nil. A render can resolve at most 20 unique types through one
metaobjects object.
Examples
Dot and bracket lookup
{% assign testimonials = metaobjects.testimonial %}{% assign featured = metaobjects['testimonial']['featured-customer'] %}
{% if featured %} <blockquote>{{ featured.quote.value }}</blockquote>{% endif %}Use bracket notation when the definition type or entry handle is stored in a variable:
{% assign definition = metaobjects[section.settings.metaobject_type] %}{% assign entry = definition[section.settings.metaobject_handle] %}Both entry lookups are tenant-scoped and include only storefront-visible
entries. Publish status is enforced for publishable definitions. A missing
handle returns nil; a valid but missing definition type is an empty container.
Loop or paginate entries
{% paginate metaobjects.testimonial.values by 24 %} {% for testimonial in metaobjects.testimonial.values %} <article>{{ testimonial.quote.value }}</article> {% endfor %} {{ paginate | default_pagination }}{% endpaginate %}An ordinary values loop loads at most 50 entries. Pagination supports up to
250 entries per page and remains subject to the 25,000 reachable-item limit.
Properties
| Property | Description |
|---|
This lookup has no static properties. Metaobject types are dynamic keys.
Limits
| Operation | Limit |
|---|---|
| Unique type facades created in one render | 20 |
| Unique direct handles per definition | 20 |
Ordinary values enumeration | 50 entries |
Paginated values page | 250 entries |
Direct-handle access is memoized but is not a substitute for pagination. Use
metaobject_definition.values when rendering a list.