# Product custom fields

If Breww's built-in product fields don't capture something you need to record, you can add fields of your own. Custom fields appear on the form when you create or edit a product, show on the product's page, and can be used in [BrewwQL](https://breww.com/docs/introduction-to-brewwql/) to filter and report on your products.

You'll find them under **Settings** -> **Sales, orders & invoices** -> **Product custom fields**.

The list shows each field's name, the product types it applies to, its type, its description and whether it's required.

## Creating a custom field

Press **New custom field** and fill in:

* **Name** - what you'll see on the product form, and the name you'll use when filtering with BrewwQL.
* **Which product types does this field apply to?** - pick one or more of Stock item, Cask, Keg, Smallpack, Multi-pack, Mixed-pack and Service. The field only appears on products of the types you choose, and the list shows "All" if you pick every one.
* **Field type** - what kind of value the field holds. See the table below.
* **Description** - optional. Shown as help text beneath the field on the product form, and as a tooltip on the product page.
* **Required** - whether a value has to be given before the product can be saved.

### Field types

| Field type      | What it holds                         |
| --------------- | ------------------------------------- |
| Short text      | A single line of text                 |
| Long text       | Several lines of text                 |
| Date            | A date                                |
| Date & time     | A date and a time                     |
| Decimal number  | A number that can have decimal places |
| Whole number    | A number with no decimal places       |
| True / False    | A checkbox                            |
| Multiple Choice | A value chosen from a list you define |

Choosing **Multiple Choice** reveals an **Options** section. Add a row per option with the **Add item** button, and remove one with the button at the end of its row. Options have to be unique and you need at least one. Enable **Can select multiple?** if a product should be able to have more than one of them selected at once.

### Naming rules

Because the name doubles as the name you'll use in BrewwQL, Breww applies a few rules to it:

* It must be unique among your product custom fields.
* It must start with a letter, although it can contain numbers after that.
* It can't be "And" or "Or".
* It can't match one of Breww's own built-in product field names.
* It needs enough ordinary letters and numbers to make a usable name, so a name made up almost entirely of symbols is rejected.

## Where your custom fields appear

* On the **New product** wizard and the **Edit product** form, for products of the types the field applies to.
* In a **Custom fields** panel on the product's page, with any description shown as a tooltip.
* In **BrewwQL**, so you can filter product lists and reports on the value.
* In the **product importer and bulk updater**, so you can set values in bulk. Every field type is supported there except Date & time. For a Multiple Choice field with **Can select multiple?** enabled, separate the option names with commas in the cell, for example `Gluten free, Vegan`; the bulk updater download lists the selected options the same way. See [Bulk updating data](https://breww.com/docs/bulk-updating-data/) and the [Data import guide](https://breww.com/docs/data-import-guide/).

## Editing and deleting a custom field

Use the pencil button on a row to edit a field's setup, and the bin button to delete it.

> **Warning:**
> Deleting a custom field also deletes every value stored in it, on every product, and this can't be undone. Breww won't let you delete a field while products are still using it, so you'll need to clear it from those products first.

Two things to watch when editing:

* **Renaming a field changes the name you use for it in BrewwQL.** Any saved list or filter that refers to the old name will need updating.
* **Changing the field type of a field that already holds values** means those existing values will no longer show, because they're stored in a different format for each type. Only change the type when you're confident the field isn't in use.

For a **Multiple Choice** field, Breww won't let you edit the setup at all once products have chosen from its options, because saving rebuilds the option list. Clear the field from those products first.
