# Metafields

You can update product and variant metafields based on the supplier feed.

{% hint style="info" %}
To be able to add a metafield in the Stockeo automation, you need to [add a metafield definition](https://help.shopify.com/en/manual/custom-data/metafields/metafield-definitions/creating-custom-metafield-definitions) in the Custom Data section of your store settings first.
{% endhint %}

### Update metafield single value

Add a Metafield field in the Data Mapping section. Select the metafield to be updated, and specify which column/node contains a corresponding value in the supplier feed.

<figure><img src="/files/jUWqzrrgS1fs124J6PO5" alt="Add Metafield in the Stockeo automation animated"><figcaption><p>Add metafield in the Stockeo automation</p></figcaption></figure>

For example, if you want to store all of the below properties in your store:

```xml
<Item>
<ID>
<![CDATA[ ARC-18126-1-01 ]]>
</ID>
<Width>8.00</Width>
<Size>
<![CDATA[ 18.0 İnch ]]>
</Size>
<Hole>5</Hole>
<PCD>100</PCD>
<Offset>34</Offset>
<Bore>73.1</Bore>
<Stok>15</Stok>
</Item>
```

Use the following settings in your Data Mapping section:

<figure><img src="/files/ywXOzUXATjH5od75rk2t" alt="Data Mapping section of Stockeo automation with added metafields annotated"><figcaption><p>Data Mapping section of Stockeo automation with added metafields</p></figcaption></figure>

It may be the case that the values you want to store in the metafield are nested in the **param** node, while the property **name** and its **value**, are in separate nodes.

```xml
<item>
  <param>
    <name>Brand</name>
    <value>Samsung</value>
  </param>
  <param>
    <name>Model</name>
    <value>UE55TU8500UXXU</value>
  </param>
  <param>
    <name>Screen Size</name>
    <value>55 inches</value>
  </param>
  <param>
    <name>Resolution</name>
    <value>4K Ultra HD</value>
  </param>
  <param>
    <name>Smart TV</name>
    <value>Yes</value>
  </param>
</item>

```

To get them you need to use a Liquid formula in the **Mapping** field with the **where** and **map** filters:

```liquid
{{ param | where: "name", "Brand" | map: "value" }}
```

In this code, **param** refers to a node that contains other nodes with the property name and its value. **"name"** is the name of the node that contains the **"Brand"** property, while **"value"** is the information to be stored in the metafield.

For the feed above use the following settings:

<figure><img src="/files/r73wBamb5a4r0ANN3f0A" alt="How to get the value to be stored in the metafield from the param node"><figcaption><p>Get the value to be stored in the metafield from the param node</p></figcaption></figure>

{% hint style="info" %}
A special use case for metafields is to employ one of them as the product/variant identifier instead of the SKU field.

Check out how to [use a variant metafield to recognize a product from the feed](/data-mapping/sku.md#use-variant-metafield-to-recognize-a-product-from-the-feed).
{% endhint %}

### Update metafield lists

Stockeo enables you to update metafield lists that allow storing multiple values in a single metafield.

{% hint style="info" %}
Stockeo can only overwrite a current metafield list. There is no mode to add new items and keep the old ones.
{% endhint %}

To pass a list of values to Shopify correctly, ensure commas separate values:

<figure><img src="/files/wRiqD3pC2OtkhfvBhDtO" alt=""><figcaption><p>Commas separated values to be passed as a metafield list</p></figcaption></figure>

If a different separator is used, a semicolon, for instance, add a Liquid formula to convert it to commas:

```liquid
{{ Ingredients | replace: ";","," }}
```

<figure><img src="/files/HjEz0wSHYYDvasYowCAf" alt=""><figcaption><p>Replace semicolons with commas using Liquid</p></figcaption></figure>

You can also use Liquid to pass values from multiple columns/fields:

<figure><img src="/files/gE99AuFM3vC3NkbXaw96" alt=""><figcaption><p>Values to be passed included in separate columns</p></figcaption></figure>

<figure><img src="/files/NkhSMOTpMugqTjUn8Cl5" alt=""><figcaption><p>Use Liquid to pass values from different columns</p></figcaption></figure>

To assign a fixed metafield list of values for each variant, use another Liquid formula:

<figure><img src="/files/oa5ISdsqLkV8rL35JxTp" alt=""><figcaption><p>Use Liquid to pass a fixed values list</p></figcaption></figure>

### Use variant metafield to recognize a product from the feed

In case you do not have in your store the same SKUs of products as in the feed, but you store those SKUs in the metafields for individual products, you can use variant metafields as the key to enable Stockeo to associate product from your store with the product from the feed.

{% tabs %}
{% tab title="SKU and variant metafield" %}

<figure><img src="/files/xoOtQmIVAOF1ViDNNbfp" alt="Shopify example product SKU"><figcaption><p>Shopify product SKU</p></figcaption></figure>

<figure><img src="/files/zXeWPOqwt0BrkeIHenr1" alt="Custom SKU stored as the variant metafield annotated"><figcaption><p>Custom SKU stored as the variant metafield</p></figcaption></figure>
{% endtab %}

{% tab title="Supplier feed" %}

```xml
<Item>
    <ID>
        <![CDATA[ARC-18126-2-29]]>
    </ID>
    <Brand>
        <![CDATA[ARCEO]]>
    </Brand>
    <Price>695.00</Price>
    <Stok>32.00</Stok>
</Item>
```

{% endtab %}
{% endtabs %}

Use the following settings in the Data Mapping section of your automation:

Add a new **Metafield** field:

<figure><img src="/files/ORFTRH4IHvs2kpNwbbIH" alt="Add new metafield field in Stockeo automation animated"><figcaption><p>Add new Metafield field</p></figcaption></figure>

Select the variant metafield with the product SKU that matches the SKU in the feed.

<figure><img src="/files/AHEQKR8HGuP5uU6qPCTf" alt="Select metafield with the custom SKU in the Stockeo automation"><figcaption><p>Select metafield with the custom SKU</p></figcaption></figure>

Enter the name of the feed node where the SKU is stored.

<figure><img src="/files/2uZOPHxUREkNanLxfWKT" alt="Mapping SKU from the feed in the Stockeo automation"><figcaption><p>Mapping SKU from the feed</p></figcaption></figure>

Hit the gear icon. This button will be active if you select your variant metafield. Check the option **Use a variant ID**.

<figure><img src="/files/ZqG17Gsm4Jw5TMNwJl22" alt="Use metafield as variant ID in the Stockeo automation annotated"><figcaption><p>Use metafield as variant ID</p></figcaption></figure>

Delete the default SKU field in your automation. This is possible only if you checked the option above.

<figure><img src="/files/xnosx59HhrCMj3wajDjP" alt="Delete the SKU field in the Stockeo automation animated"><figcaption><p>Delete the SKU field</p></figcaption></figure>

Otherwise, the SKUs of your items will be updated according to the value from the feed.

You can also use [barcodes](/data-mapping/barcode.md) to identify variants in Shopify when SKUs are missing from the feed or do not match the SKUs in Shopify.

### Metaobjects

Stockeo supports importing data into metafields of type metaobject. When processing your feed, Stockeo matches incoming values to existing metaobject entries in your store using either the **display name** or the **handle**. Please note that matching is case-sensitive.

Stockeo does not create new metaobjects entries. If a value in your feed doesn’t match an existing metaobject, it will be skipped.

***

### Supported metafields types

Stockeo enables you to update values for the following types of metafields:

**Single values**

* Boolean
* Color
* Data
* Date and Time
* Decimal
* Integer
* Metaobject
* Multi-line text
* Single-line text
* URL

**Lists of values**

* Single-line texts
* Decimals
* Integers
* URLs


---

# 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://help.stockeo.solvenium.com/data-mapping/metafields.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.
