Skip to main content

metaobject_definition

A metaobject_definition defines the structure of a metaobject type for the store, which consists of a merchant-defined set of field definitions.

One or more corresponding metaobject objects contain values for the fields specified in the metaobject definition.

Properties

Anchor to
values
array of metaobject

The metaobjects that follow the definition.

Anchor to
values_count

The total number of entries for the metaobject definition.

Anchor to Loop over entries of a metaobject definition

Loop over entries of a metaobject definition

If a metaobject definition has multiple metaobject entries, then you can loop over them using the values property. You can loop over a maximum of 50 entries in a metaobject definition. For example, you can display the field author for each metaobject using the following forloop:

{% for testimonial in metaobjects.testimonials.values %}
{{ testimonial.author.value }}
{% endfor %}

Note

When the publishable capability is enabled, loops return only metaobjects with a status of active. Metaobjects with a status of draft are skipped.


Was this section helpful?