> For the complete documentation index, see [llms.txt](https://native-app-co.gitbook.io/product-pelican/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://native-app-co.gitbook.io/product-pelican/metafields/generating-metafield-values.md).

# Generating metafield values

Have the AI fill your product metafields — set-up, writing the instructions, reviewing and applying, and what to do when a field comes back empty.

Product Pelican can fill product metafields for you. You choose the metafields and say what belongs in each, and a value for each is generated with every description. You review every value before it is saved.

## Set it up

1. Open **AI Prompts** → **Products** → **Metafields**.
2. Under **Metafields to generate**, choose a metafield from **Add a metafield**.
3. Write the instructions for that metafield — what should go in it.
4. Repeat for each metafield you want filled, then save.

### Which metafields can be filled

The dropdown lists your **product** metafields of these types:

* **Single line text** (one value, not a list)
* **Multi-line text**
* **JSON**

If a metafield isn't in the dropdown, it is one of these:

| Reason                                             | What to do                                                                                                                                               |
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| It has no definition                               | [Create one](https://native-app-co.gitbook.io/product-pelican/metafields/creating-metafields.md)                                                         |
| It is another type — a list, a number, a reference | Create a text or JSON metafield for the AI to fill                                                                                                       |
| It belongs to Shopify or to another app            | These are never written to. They can still be [read as context](https://native-app-co.gitbook.io/product-pelican/metafields/metafields-as-ai-context.md) |
| It is a collection metafield                       | Only product metafields can be generated                                                                                                                 |
| It is already configured                           | Each metafield can be added once                                                                                                                         |
| It is a Google Shopping field                      | Tick it in the **Google Merchant Center** section of the same page instead                                                                               |

You can configure up to **40** metafields, Google Shopping fields included. Once you reach 40, the page says so and you can add another only after removing one.

### Writing the instructions

Each metafield has its own instructions, up to 3,000 characters. A count appears under the box as you get close, and instructions over the limit are marked in red and not saved until you shorten them. Say **what** goes in the field, **how long** it should be, and **what to do when the product data doesn't say**.

> **Material** — The main material, in two or three words, for example "Organic cotton". Leave empty if the product data doesn't state it.

> **Care instructions** — Washing and drying instructions, one per line, no more than five lines. Only use what is stated in the product data.

> **What's in the box** — Every item included, one per line, with quantities.

* **Always write instructions.** Without them the AI has only the metafield's name.
* **Ask for one item per line** when you want a list.
* **Say "leave empty if unknown"** to stop the AI padding.
* **Spell out fixed values:** "Answer with exactly one of: Slim, Regular, Relaxed."

### JSON metafields

For a JSON metafield, describe the **shape** as well as the content:

> A list of objects, one per specification, each with `name` and `value`. For example `[{"name": "Weight", "value": "1.2 kg"}]`.

An answer that isn't valid JSON is not saved, and the field is listed as unfilled.

## What the AI works from

For each product the AI is given:

* the title, product type, vendor and tags
* the start of the **current** description
* the metafields ticked as context on the **Metafields** prompt — its own selection, separate from the Description prompt's. See [Using metafields as AI context](https://native-app-co.gitbook.io/product-pelican/metafields/metafields-as-ai-context.md)
* the product photos, when [image analysis](https://native-app-co.gitbook.io/product-pelican/ai-content/image-recognition.md) is on

{% hint style="info" %}
**Metafields are written from the product's existing data, not from the new description.** If the facts aren't in the product data yet, turn on image analysis or add them as context.
{% endhint %}

## Reviewing and applying

Metafields are generated in **Products** → **Descriptions**. Under the suggested description, each metafield gets a row:

* a **checkbox** — ticked to begin with; untick a value you don't want
* the **value**, in a box you can edit before applying
* a **Show thinking** link with the AI's reasoning

The description has its own checkbox, so you can apply either without the other.

{% hint style="warning" %}
**Applying replaces the metafield's current value**, and the row does not show what is there now. To fill gaps only, untick the rows for metafields that are already filled.
{% endhint %}

### Fields the AI left empty

When the AI has no answer for a metafield, the field is named in a notice under the rows and nothing is written for it. The usual causes:

* **The product data doesn't contain the answer.** Add the source as context, or turn on image analysis.
* **The instructions point at something the AI can't see**, such as a metafield that isn't ticked as context.
* **The field doesn't apply to this product.** An empty field is better than an invented one.

**Show thinking** usually tells you which.

## Working through a catalogue

To fill metafields across your whole catalogue without touching descriptions, use the [Product metafields job](https://native-app-co.gitbook.io/product-pelican/jobs/product-metafields.md). It works through your active products in the background and fills only the metafields that are empty.

To do it by hand, one pass over the **Descriptions** tab fills the description and every configured metafield. Use the **All** preset to include products whose descriptions are already fine, and untick the description on those rows.

Each photo the AI looks at counts once toward your monthly image allowance, however many metafields it fills.

## Troubleshooting

| What you see                               | What it means                                                                                                                                               |
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| No metafield rows under the description    | No metafields are configured on the Metafields prompt, or the changes there weren't saved                                                                   |
| "The following fields were not populated…" | See [Fields the AI left empty](#fields-the-ai-left-empty)                                                                                                   |
| "Not valid JSON"                           | A JSON value — often one you edited in the box — doesn't parse. Fix it, or untick the row                                                                   |
| "Description updated · metafields failed"  | The description was saved but Shopify rejected a metafield value, usually because of a validation rule on the definition. Correct the value and apply again |
| A value is a list squeezed onto one line   | Ask for "one item per line" in that metafield's instructions                                                                                                |
| The same wrong value on many products      | The instructions are being read differently from how you meant them. Open **Show thinking**, then tighten the wording                                       |

## Related pages

* [Creating metafields](https://native-app-co.gitbook.io/product-pelican/metafields/creating-metafields.md)
* [Using metafields as AI context](https://native-app-co.gitbook.io/product-pelican/metafields/metafields-as-ai-context.md)
* [Product metafields job](https://native-app-co.gitbook.io/product-pelican/jobs/product-metafields.md) — fill empty metafields across your catalogue in the background.
* [Google Shopping fields](https://native-app-co.gitbook.io/product-pelican/products-and-collections/google-merchant-center.md) — the ready-made fields for your product feed.
* [Image analysis](https://native-app-co.gitbook.io/product-pelican/ai-content/image-recognition.md)
* [Product audit](https://native-app-co.gitbook.io/product-pelican/products-and-collections/product-audit.md) — the Descriptions tab.
