# Metafields and Metaobjects

Metafields and Metaobjects are powerful tools to enrich your store with extra information. You can think of them like CMS lists or collection fields in Webflow.

<figure><img src="/files/ea1dBqqTS6ptpHZNezAm" alt=""><figcaption></figcaption></figure>

### Metafields

There are no special attributes for metafields in <code class="expression">space.vars.Company</code>, but you can still use them with `li-object`, `li-if`, `li-unless`, `li-for`, and `li-attribute.` Basically with any attribute that can work directly with Shopify objects.

Metafields can be created for many resources in your store, such as products, collections, articles, and more. You can set them up in your Shopify admin under Metafields and Metaobjects. The actual content of each metafield is edited on the resource’s detail page in the Shopify backend.

They are attached to a resource object and identified by a namespace (usually custom by default) and a key (the unique name of the field).

Here’s the Shopify metafield documentation if you need more details: <https://shopify.dev/docs/api/liquid/objects/metafield>

For example, you can access a product metafield like this:

{% columns %}
{% column %}
{% code title="Webflow" fullWidth="false" %}

```
li-object = product.metafields.custom.size
```

{% endcode %}
{% endcolumn %}

{% column %}
{% code title="Shopify" fullWidth="false" %}

```html
<p>{{ product.metafields.custom.size }}</p>
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}

Or from a collection like this:

{% columns %}
{% column %}
{% code title="Webflow" fullWidth="false" %}

```
li-object = collection.metafields.custom.info
```

{% endcode %}
{% endcolumn %}

{% column %}
{% code title="Shopify" fullWidth="false" %}

```html
<p>{{ collection.metafields.custom.info }}</p>
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}

#### Metafield Types

There are different metafield types you can define in the Shopify settings — such as text, numbers, files, or even references to other products, articles, or metaobjects. All of them work almost the same when you access their data in <code class="expression">space.vars.Company</code>.

**Files**

When using a metafield of type file, you need to apply the correct filter for that file type. For example, an image requires the image\_url filter, like this:

{% columns %}
{% column %}
{% code title="Webflow" fullWidth="false" %}

```html
li-object:src="product.metafields.custom.instructions | image_url: width: 1000
```

{% endcode %}
{% endcolumn %}

{% column %}
{% code title="Shopify" fullWidth="false" %}

```html
<img src="product.metafields.custom.instructions | image_url: width: 1000">
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}

**Accessing metafields of type `list`**

Metafields of type list return an array in their value property. You can loop through this array using `li-for` to access each item.

{% columns %}
{% column %}
{% code title="Webflow" fullWidth="false" %}

```html
<div li-for:inside="item in product.metafields.custom.ingredients.value">
    <div li-object="item"></div>
</div>
```

{% endcode %}
{% endcolumn %}

{% column %}
{% code title="Shopify" fullWidth="false" %}

```html
<div> 
    {% for item in product.metafields.custom.ingredients.value %}
        <div>{{ item }}</div>
    {% endfor %}
</div>
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}

### Metaobjects

Metaobjects are always arrays. You can create different property types for a metaobject, such as title or description. When you iterate over a metaobject, you can access these properties for each item in the array. For example:

{% columns %}
{% column %}
{% code title="Webflow" fullWidth="false" %}

```html
<div li-for:inside="faq in shop.metaobjects.fa_qs.values">
    <div li-object="faq.title"></div>
</div>
```

{% endcode %}
{% endcolumn %}

{% column %}
{% code title="Shopify" fullWidth="false" %}

```html
<div> 
    {% for faq in shop.metaobjects.fa_qs.values %}
        <div>{{ faq.title }}</div>
    {% endfor %}
</div>
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.liquiflow.app/liquid-attributes/metafields-and-metaobjects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
