# Set up Rep's metafields

Chapter 7 of the Rep user guide.

Rep's features read three kinds of data, none of which needs an app:

* **Metafields** in the `custom` namespace (the one Shopify admin uses when you create a definition): nine on products and one on variants.
* **Theme settings** in **Theme settings › Activity**, **Fabric and fit**, **Sets** and **Fit finder**, and the blocks' own settings: your activity names, compression words, inseam labels, set discount and size chart.
* **Product option names and values**: your colour, size and inseam options, matched by name.

Rep doesn't use metaobjects, so there is nothing to set up under **Content › Metaobjects**. You only need the data for the features you use, and nothing breaks while you fill it in: each part of a feature shows only when it has data, and the theme settings give every product sensible defaults.

In Shopify admin, metafield definitions live under **Settings › Custom data** (called **Metafields and metaobjects** in newer versions of the admin).

## The metafields Rep reads

Keys are exact and case-sensitive. The name is yours to choose: it's what you see when you edit a product.

| Namespace and key | Owner | Type in admin | Example | What reads it |
| --- | --- | --- | --- | --- |
| `custom.activities` | Product | **Single line text**, **List of values** (`list.single_line_text_field`) | Train, Yoga, Pilates | The activity icons on cards, the activity pills on the product page, and the **Activity** filter (chapter 8) |
| `custom.support_level` | Product | **Single line text** (`single_line_text_field`) | High | The support pill on cards and on the product page, and the **Support level** filter (chapter 8) |
| `custom.compression` | Product | **Integer** (`number_integer`), 1 to 5 | 4 | The compression meter, the size-up line and the fit finder's between-sizes rule (chapters 9 and 11) |
| `custom.stretch` | Product | **Single line text** | 4-way stretch | The Fabric and fit card's **Stretch** (chapter 9) |
| `custom.fit_type` | Product | **Single line text** | Second skin | The Fabric and fit card's **Fit**, and the size-up rule when it's "Compression" (chapters 9 and 11) |
| `custom.fabric_features` | Product | **Single line text**, **List of values** | Squat-proof, Sweat-wicking, Pockets, Recycled | The Fabric and fit card's feature chips (chapter 9) |
| `custom.composition` | Product | **Single line text** | 75% recycled nylon, 25% elastane | The Fabric and fit card's last line (chapter 9) |
| `custom.set_with` | Product | **Product**, **List of products** (`list.product_reference`) | Lift high-support bra | Complete the set: the pieces that go with this product (chapter 10) |
| `custom.size_matrix` | Product | **Multi-line text** (`multi_line_text_field`) | `Size \| Height cm \| Weight kg`, then one size per line | The fit finder and the How it fits chart, in place of **Theme settings › Fit finder › Size chart** (chapter 11) |
| `custom.inseam` | **Variant** | **Single line text** | 25 in | The inseam on the size pills or under the picker, and on cart lines (chapter 9) |

A **Specification row** block can show any other product metafield you create (chapter 6).

## How to fill them in

**Activities** (`custom.activities`): one activity per value, such as `Train`, `Run`, `Yoga`, `Pilates`, `Lounge`. Capitals don't matter for the icons, and you can write any activity you sell for. These names get a pictogram:

| Pictogram | Names that use it |
| --- | --- |
| Train (dumbbell) | Train, Training, Gym, Strength, Weights, Lift, Lifting, HIIT |
| Run (shoe) | Run, Running, Road, Track, Race, Race day, Jog, Jogging |
| Yoga (lotus) | Yoga |
| Pilates (ring) | Pilates, Barre, Reformer |
| Lounge (moon) | Lounge, Lounging, Rest, Rest day, Recovery |
| Cycle | Cycle, Cycling, Ride, Bike, Spin |
| Hike | Hike, Hiking, Trail, Walk, Walking, Outdoor |
| Swim | Swim, Swimming |
| Box | Box, Boxing |
| Dance | Dance, Dancing |
| Tennis | Tennis, Pickleball, Padel |

Any other name gets a small dot in place of a pictogram and still counts: it's read out with the rest ("For train, yoga and climbing"). Cards show the first three in the order you list them, so put the most important first. **Spell each activity exactly as in your Activity list and tile names** ("Yoga", not "yoga practice"): the tiles and pills link to the filter by that word. Make it a list: a single line "Train, Yoga" still draws two icons, but the Activity filter would offer "Train, Yoga" as one value.

**Support level** (`custom.support_level`): `Low`, `Medium` or `High`, on sports bras and anything else with built-in support. These show "Low support", "Medium support" or "High support" with the three-bar meter at one, two or three bars; "Low support", "Light", "Mid", "Moderate", "Max" and "Maximum" work too, in any case. Any other text, such as "Shelf bra", shows in the pill as written, without a meter. Leave it empty on everything without support. For the filter and the support chips, write exactly `Low`, `Medium` or `High`, the words the chips link with.

**Compression** (`custom.compression`): a whole number from 1 (light) to 5 (maximum), as the meter's five segments. The words come from **Compression words** in theme settings ("4 of 5, firm hold"). A blank value, 0, a decimal or a word hides the meter; a number above 5 counts as 5. Leave it empty on mats, bottles and bags.

**Stretch** (`custom.stretch`): a short phrase, such as "4-way stretch" or "2-way stretch".

**Fit type** (`custom.fit_type`): a short phrase, such as "Second skin", "Compression" or "Relaxed". Write **Compression** for compression styles: the size-up line and the fit finder treat a style as firm when its fit type contains that word, or when its compression is at or above **Suggest sizing up from compression** (chapter 9).

**Fabric features** (`custom.fabric_features`): short phrases, one per value, such as "Squat-proof", "Sweat-wicking", "Quick-dry", "Pockets", "UPF 50+", "Recycled". Each becomes a chip with an icon chosen by its words:

| Icon | Words in the feature |
| --- | --- |
| Shield | squat, opaque, shield |
| Drop | wick, sweat, moisture |
| Wind | dry, breath, mesh, vent |
| Sun | UPF, sun, UV |
| Pocket | pocket |
| Recycle | recycl (Recycled, Recycling) |
| Stretch | stretch |
| Leaf | organic, cotton, natural, bamboo, merino |
| Check mark | anything else, such as "Buttery soft" |

The label always shows beside its icon. A single line separated by commas works too.

**Composition** (`custom.composition`): the fabric as it's printed on the label, such as "75% recycled nylon, 25% elastane". A full stop is added if it doesn't end in one.

**Set with** (`custom.set_with`): the products that go with this one, in the order you want them listed: on the leggings, the matching bra; on the bra, the leggings. Up to three are shown (chapter 10). Fill it in on each piece, both ways, so the set shows whichever piece a shopper opens first. Give matching pieces the same colour names ("Fern" on both).

**Size matrix** (`custom.size_matrix`): only for a product that's cut differently from your theme-wide **Size chart**, such as compression leggings that run small, or a product where you want extra columns in its How it fits chart. The same format as the theme setting: a header line, then one size per line, cells separated by `|`:

```
Size | Height cm | Weight kg | Waist cm
XS | 150–160 | 45–52 | 60–65
S | 155–165 | 52–60 | 65–70
M | 160–170 | 60–68 | 70–76
L | 165–175 | 68–77 | 76–82
XL | 170–180 | 77–88 | 82–90
```

* **The first column is the size**, written exactly as in the product's Size option ("M", not "Medium").
* **The header line comes first.** It's recognised because its second cell doesn't start with a number, and its headings tell Rep which columns to use: one heading containing **Height** and one containing **Weight**. Without a header, the second column is read as height in cm and the third as weight in kg.
* **Units**: heights in centimetres, in inches with `in` in the heading (`Height in`), or in feet with `ft` in the heading (`Height ft`, decimal feet such as `5.4`); weights in kilograms, or in pounds with `lb` in the heading (`Weight lb`). Rep converts them. Feet and inches written together, such as `5'4`, `5'4"` or `5 ft 4 in`, are read as feet and inches under any heading.
* **Ranges** use a hyphen (`150-160`), an en dash (`150–160`) or "to" (`150 to 160`). A unit in a cell, such as `150–160 cm`, is ignored.
* **An open range** such as `88+` means 88 and up: the fit finder gives it the same width as the row above (for `XL | 170–180 | 88+` after a 9 kg-wide row, 88 to 97 kg).
* **Extra columns**, such as `Waist cm` or `Hip cm`, show in the How it fits chart but are ignored by the fit finder's maths.
* Blank lines and lines starting with `#` are skipped. A row without a readable height and weight range is left out of both the chart and the maths.
* A product's chart replaces the theme setting only when it has at least two sizes the fit finder can read.

Imperial example:

```
Size | Height in | Weight lb
S | 61–65 | 115–130
M | 63–67 | 130–150
L | 65–69 | 150–170
```

**Inseam** (`custom.inseam`): on each **variant**, its inside leg length as you want shoppers to read it, such as "25 in" or "64 cm". Only for products that don't have an Inseam option: when every variant shares one length (running shorts at "4 in") it shows as one line under the size pills; when it differs by size, each size pill shows its own (chapter 9).

## Step 1: create the definitions

In admin, go to **Settings › Custom data › Products** and click **Add definition** for each product metafield you need:

1. Type the **Name**: Activities, Support level, Compression, Stretch, Fit type, Fabric features, Composition, Set with or Size matrix.
2. Check the **Namespace and key** under it and change it to exactly the key in the table. Shopify suggests `custom.` plus the name, so "Fit type" gives `custom.fit_type`, but a name like "Set with (matching pieces)" would give something like `custom.set_with_matching_pieces`, which the theme won't find. Change it to `custom.set_with`.
3. Click **Select type** and choose the type in the table:
   * **Single line text** for activities, support level, stretch, fit type, fabric features and composition. For **Activities** and **Fabric features**, change **One value** to **List of values**.
   * **Integer** for compression, with **One value**. Under validations, set a minimum of 1 and a maximum of 5, so a wrong number can't be saved.
   * **Product** for set with, and change **One value** to **List of values** (**List of products**).
   * **Multi-line text** for size matrix.
4. **Save**.

Then go to **Settings › Custom data › Variants**, click **Add definition** and add **Inseam**: key `custom.inseam`, type **Single line text**, **One value**.

For the filters, **Activities** and **Support level** must be usable in Search & Discovery. If the app later doesn't offer them as a filter source, open the definition again and check its storefront access and filter options: the wording depends on your admin version.

## Step 2: fill them in

Open a product in admin and scroll to **Metafields**. For **Inseam**, click each variant in the product's **Variants** list and fill it in on the variant's page. To fill in many at once, select your products, use **Bulk edit** and add the metafield columns there. Metafields can also go through a product CSV, once they're defined.

The size matrix keeps line breaks: press Enter between lines.

## Step 3: set up the filters

Install Shopify's free **Search & Discovery** app and add **Activity** (from `custom.activities`), **Support level** (from `custom.support_level`), **Size** and **Colour** as filters. The activity tiles, the activity pills, the support chips and cards, and the fit finder's **Shop in size M** link to them. Chapter 13 has the steps.

## Step 4: check

* Open a collection: a product with activities should show up to three small icons beside its price, and a bra with a support level the support pill at the bottom left of its photo.
* Open that product: the activity pills sit above the title, and the **Fabric and fit** card shows the meter ("4 of 5, firm hold"), stretch, fit, chips and composition.
* Open leggings with an Inseam option: the inseam lengths sit under the sizes. Open shorts whose variants all have `custom.inseam` "4 in": "Inseam: 4 in" sits under the sizes.
* Open a product with `custom.set_with`: **Complete the set** lists its pieces in the same colour. Change the colour and the pieces follow.
* Click **Fit finder**, enter 168 cm and 63 kg with **True to size**: with the default chart, it says **Your size: M**. Open another product: "Your size: M" is beside its size label.

If a value doesn't show, check the namespace and key first, then the owner (product or variant), then the type.
