> For the complete documentation index, see [llms.txt](https://kb.craftformswp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kb.craftformswp.com/documentation/form-building/create-form/acf-meta-box-acpt-fields.md). Agents can also search and read this documentation through its [MCP server](https://kb.craftformswp.com/~gitbook/mcp).

# ACF, Meta Box and ACPT Fields

Use fields made with ACF, Meta Box or ACPT in your forms, as dynamic tags, as the choices of a Radio, Checkboxes or Select field, and in smart variables.

If your site stores its data in custom fields made with **Advanced Custom Fields (ACF)**, **Meta Box** or **ACPT**, a form can use them directly. One form placed on many pages (tours, apartments, events, products) then shows each page's own data:

* **Dynamic tags** show a field's value in the form: a tour's duration in a label, a price in a text (free).
* **Choices from a custom field** fill a Radio, Checkboxes or Select field from a repeater or a list: the stops of a tour, the extras of an apartment (PRO).
* **Smart variables** read a field into the price formula: the base price, the number of rows in a repeater (PRO).

CraftForms reads the fields through each plugin's own functions, so it works whether the plugin keeps the values as post meta or in its own tables. Only fields the plugin has registered are read, never other data, and password fields never are.

## What you need

* ACF (free or PRO), Meta Box (with any extensions) or ACPT (PRO or Lite), active on the site. ACPT Lite has Text, Textarea, Select, Email and Date fields, so with Lite you get tags, smart variables and a Select field's choices; repeaters need ACPT PRO.
* **CraftForms PRO** for choices from a field and for smart variables. Dynamic tags work in the free version.

## Dynamic tags (free)

Insert a field like any other dynamic tag: click the **Insert dynamic data** icon next to a label, a default value or a text, and pick the field from the **ACF**, **Meta Box** or **ACPT** group. Or type the tag:

| Tag                                       | Shows                                       |
| ----------------------------------------- | ------------------------------------------- |
| `{{acf.<field_name>}}`                    | An ACF field of the page the form is on     |
| `{{acf.option.<field_name>}}`             | An ACF field of an options page             |
| `{{mb.<field_id>}}`                       | A Meta Box field of the page the form is on |
| `{{mb.setting.<option_name>.<field_id>}}` | A Meta Box settings page field              |
| `{{acpt.<box>.<field>}}`                  | An ACPT field of the page the form is on    |
| `{{acpt.option.<page>.<box>.<field>}}`    | An ACPT option page field                   |

How values show:

* A list (checkboxes, a multiple select, a relationship) shows as "a, b, c". A choice field shows its labels, not its stored values: "Small, Large".
* A repeater shows its rows' values, separated by commas. For a list of rows as choices, use [Choices from a custom field](#choices-from-a-custom-field-pro) instead.
* An image shows its URL, a post its title, a true/false field Yes or nothing.

Add a fallback after `|` for pages that have no value: `{{acf.duration|on request}}`. See [Dynamic tags and variables](https://kb.craftformswp.com/documentation/form-building/create-form/dynamic-tags-and-variables.md) for the other tags.

The value is read on the server when the page loads. A tag for a field that no active plugin registered shows nothing (or its fallback).

## Choices from a custom field (PRO)

A **Radio**, **Checkboxes** or **Select** field can take its choices from a field of the page:

| Field                                                                        | Becomes                                                                                                           |
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| A **repeater** (ACF Repeater, Meta Box cloneable Group, ACPT Repeater)       | One choice per row. You pick which sub-field is the label, and optionally the value, price, description and image |
| A **list field** (checkboxes, multiple select, relationship, cloneable text) | One choice per value saved on the page                                                                            |
| A **choice field** (select, checkbox, radio)                                 | Either the values saved on the page, or every choice the field defines                                            |

![Choices from a custom field in a Radio field's Options panel: an ACF repeater with its Label, Value, Price, Description and Image columns](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2F1Uoeoicb9N2d6DwlF2Mn%2Facf-meta-box-acpt-fields--acf-editor.jpg?alt=media)

1. Open the form and select the Radio, Checkboxes or Select field.
2. In the **Options** panel, turn on **Choices from a custom field**.
3. Under **Field**, pick the field. Fields are grouped by plugin and field group.
4. For a repeater: pick the **Label** sub-field. Optionally pick a **Value** (otherwise the label is the value), a **Price**, a **Description** and an **Image**. For a choice field: under **Use**, pick **Values saved on the page** or **All choices defined in the field**.
5. Save the form.

The editor shows the choices of one page that has a value for the field ("Preview: 7 choices from 'Paris walking tour'"). On the site, each page shows its own choices, read every time the page loads.

**Prices.** A price sub-field is added to the price like a price you type for a choice. Text such as "from €150" counts as 150, and both "1,250.50" and "1.250,50" read correctly.

**Descriptions and images** show with the **Cards** option style (Options Settings → Option Style).

**When the form is sent,** CraftForms reads the choices again from the page the form was shown on, so it only accepts a choice that page offers, priced as that page prices it. A page that has no value for the field shows the field without choices, and any value sent for it is refused.

## Smart variables (PRO)

A **Dynamic** smart variable can read a field. Open **Smart Variables**, add a variable, choose the **Dynamic** type and, under **Source**, **ACF / Meta Box / ACPT field**. Then pick the field and what to use:

| Use                                                     | Gives                                                                                           |
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| **The value**                                           | The field's value, as text or as a number when it is one                                        |
| **The number in it**                                    | The first number in the text: "from €150 / group" gives 150                                     |
| **How many items / rows**                               | The number of values in a list, or rows in a repeater                                           |
| **Sum of the items**, **Lowest item**, **Highest item** | Over a list, or over one **Sub-field** of a repeater, for example the sum of the extras' prices |

Set a **Default value** for pages where the field is empty or has no number. Like every dynamic variable, the value is read on the server when the page loads and again when the form is sent, so a visitor can't change it. See [Smart Variables](https://kb.craftformswp.com/documentation/form-building/create-form/form-settings-post-context/smart-variables.md) for using variables in the price formula.

## Example with ACF: a table with leg options

The tables are an ACF post type, **Table Models**, with a field group **Table details**: **Base price** (number), **Lead time** (text), **Wood** (select, several values) and a repeater **Leg options** with **Name**, **Extra price** and **Photo**. Each table has its own leg options.

![The ACF field group on the Walnut table: base price, lead time, wood and three leg options with photos and prices](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FS8r7s6fxRDgkxvn4yQcf%2Facf-meta-box-acpt-fields--acf-source.jpg?alt=media)

The form:

1. A text: "Made to order. Lead time: `{{acf.lead_time}}`."
2. A **Radio** field "Choose the legs", option style **Cards**, with **Choices from a custom field** → **Leg options**: label **Name**, price **Extra price**, image **Photo**.
3. A **Select** field "Wood" → **Wood**, **Values saved on the page**.
4. Smart variables: `base_price`, **Dynamic** → **ACF / Meta Box / ACPT field** → **Base price**; and `legs_price`, **Linked** to the Radio field's price (or use **Build price from options**).
5. Price formula: `base_price + legs_price`, shown in an InfoBlock with `{{form.price}}`.

![The form on the Walnut table: three leg cards with photos and prices, and the total](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FiqAk5weknzooLVFTvrew%2Facf-meta-box-acpt-fields--acf-front.jpg?alt=media)

The same form on the Ash table shows that table's own legs and woods:

![The same form on the Ash table: different leg options and two woods](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FR28V4lnoYrkPXEXViQEw%2Facf-meta-box-acpt-fields--acf-front-ash.jpg?alt=media)

## Example with Meta Box: workshop dates

The workshops have a Meta Box with **Price per person** (number), **Venue** (text), **Session dates** (text, cloneable) and **Dietary options** (checkbox list).

![The Meta Box fields on a workshop: price, venue, three session dates and dietary options](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2Flhwc7iS05ZPjHApr3BOh%2Facf-meta-box-acpt-fields--mb-source.jpg?alt=media)

The form:

1. A text: "`{{mb.venue}}` · €`{{mb.price_per_person}}` per person".
2. A **Select** field "Pick a date" → **Session dates**: each date saved on the workshop is a choice.
3. A **Checkboxes** field "Dietary needs" → **Dietary options**, **All choices defined in the field**.
4. A smart variable `price_pp` → **Price per person**, and the formula `price_pp * people`.

![Choices from a custom field set to the Meta Box Session dates field](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FsLOLgwYxaSh6KJoAIWZJ%2Facf-meta-box-acpt-fields--mb-editor.jpg?alt=media)

![The form on the Fresh Pasta Workshop page: a date picked from the session dates, 2 people, the total](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FtOgr1NaAIQYdOxcEjj6Y%2Facf-meta-box-acpt-fields--mb-front.jpg?alt=media)

## Example with ACPT: a price written as text

The boat tours have an ACPT box **Tour** with **Price from** (text, "from €45 per person"), **Departure point** (text) and **Boat** (select).

![The ACPT fields on a boat tour](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FufCFkCF3GnfrAzh09eQA%2Facf-meta-box-acpt-fields--acpt-source.jpg?alt=media)

The form:

1. A text: "Departure: `{{acpt.tour.departure_point}}` · `{{acpt.tour.price_from}}`".
2. A **Select** field "Boat" → **Boat**, **All choices defined in the field**.
3. A smart variable `price_pp`: **Dynamic** → **ACF / Meta Box / ACPT field** → **Price from**, **The number in it**. "from €45 per person" gives 45.
4. The formula `price_pp * guests`.

![A Dynamic smart variable reading the number from the ACPT Price from field](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2FRs4yX4cTMiORFAQ00Q8D%2Facf-meta-box-acpt-fields--acpt-editor.jpg?alt=media)

![The form on the Sunset Cruise page: 4 guests × €45 = €180](https://97821998-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FM2yV1foUgoGHBC66VBDw%2Fuploads%2F1YdM0KQYfQNAoO78SwcO%2Facf-meta-box-acpt-fields--acpt-front.jpg?alt=media)

## For developers

* Fields are addressed as `acf:<name>`, `mb:<id>` and `acpt:<box>.<field>` (with the `option.` / `setting.` forms for options pages) in the field's `fieldSource.ref` and the variable's `fieldRef`.
* The field list for the editor is at `GET /wp-json/craftforms/v1/custom-fields` (users who can edit posts).
* A host can turn the tags off per plugin with the `craftforms_feature_enabled` filter, keys `merge_tags:acf`, `merge_tags:mb` and `merge_tags:acpt`.
