# Metafields

Metafields are extra data you attach to products, beyond the standard title/price/description. DRIFT Pro uses one custom metafield, plus reads ratings from the Shopify Reviews app if installed.

## What metafields DRIFT Pro uses

| Metafield              | What it does                               | Type                          |
| ---------------------- | ------------------------------------------ | ----------------------------- |
| `custom.size_chart`    | Shows a size chart in a modal on the PDP   | Rich text                     |
| `reviews.rating`       | Star rating shown on product cards and PDP | Rating (Shopify Reviews app)  |
| `reviews.rating_count` | Number of reviews next to the rating       | Integer (Shopify Reviews app) |

## Detail pages

* [**Size Chart**](/drift/drift-pro/metafields/size-chart.md) — modal-based size guide on every PDP

## Reviews integration

DRIFT Pro reads `reviews.rating` and `reviews.rating_count` automatically when present. These metafields are populated by the [Shopify Product Reviews app](https://apps.shopify.com/product-reviews) (or any reviews app that writes to the same namespace and keys). Install the app, collect reviews, and the rating displays on product cards and the PDP without any theme changes.

## How to set up a metafield in Shopify

You only do this once per metafield, then any product can use it.

1. Open Shopify admin → **Settings** → **Custom data**
2. Pick **Products**
3. Click **Add definition**
4. Fill in:
   * **Name** — human-friendly name (e.g., "Size Chart")
   * **Namespace and key** — must match exactly what DRIFT expects (see each metafield page)
   * **Type** — must match (rich text, etc.)
5. Save

Now go to any product. Scroll to the bottom of the product page in admin. You'll see a **Metafields** section where you can fill in values per product.

## Heads up on namespace and key

DRIFT looks for the size chart under the `custom` namespace (Shopify's default for store-managed metafields). The key must be exactly `custom.size_chart`.

If you use a different namespace or misspell the key, the theme won't find the value and the feature won't activate. No error message — it just silently doesn't show.

## Bulk editing

If you have hundreds of products, editing metafields one at a time isn't realistic. Two options:

* **Shopify's bulk editor** — Products → select multiple → Bulk edit → add the metafield column
* **Matrixify or Excelify apps** — CSV import/export of metafields

Both work fine with DRIFT.

## On product badges

DRIFT Pro renders an automatic sale badge on products where `compare_at_price` is higher than the regular price. There is no custom badge metafield in Pro — the sale badge is the only badge. To control whether a product shows a sale badge, set or unset its compare-at price in the product editor.


---

# 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.webexp.dev/drift/drift-pro/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.
