> 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/dynamic-tags-and-variables.md).

# Dynamic Tags and Variables

A CraftForms form can calculate, transform and display data while the visitor fills it in. Emails and PDFs can show the submitted data, the site, the date and, for WooCommerce orders, the whole order. All of this uses **variables** and **dynamic tags**.

### Variables and dynamic tags <a href="#variables-and-dynamic-tags" id="variables-and-dynamic-tags"></a>

They look almost the same, but they're used in different places and written differently:

* **Variables** are used in the Price Formula and in smart variables' formulas and expressions, for calculations and data transformations. You write them by name alone. If you have a variable `pages`, the formula says `pages * 2`.
* **Dynamic tags** display data: in an Info Block, in field and choice labels, in email and PDF templates, and in action settings such as an email's subject or recipient. You write them with a namespace, wrapped in double curly braces: `{{field.pages}}`.

Type `{{` in a supported field to open the menu of the tags available there. Many settings fields also have a **Dynamic data** picker button that lists the same tags.

The special tag `{{price}}` has no namespace but still needs the braces.

A tag that has no value where it's used (for example a WooCommerce tag on a form that isn't connected to a product) shows nothing rather than an error.

### Where each namespace works <a href="#where-each-namespace-works" id="where-each-namespace-works"></a>

| Namespace                                    | Example                  | Works in                                             | Shows                                                 |
| -------------------------------------------- | ------------------------ | ---------------------------------------------------- | ----------------------------------------------------- |
| `field.`                                     | `{{field.pages}}`        | The form (Info Block, labels)                        | A field's current value, or an exposed smart variable |
| `error.`                                     | `{{error.email}}`        | The form                                             | A field's validation message                          |
| `form.`                                      | `{{form.price}}`         | The form                                             | The calculated price and its tax breakdown            |
| `email.`                                     | `{{email.name}}`         | Email and PDF templates, action settings             | A submitted field                                     |
| `submission.`                                | `{{submission.id}}`      | Email and PDF templates, action settings             | The saved submission and where it came from           |
| `catalog.`                                   | `{{catalog.title}}`      | Email and PDF templates, action settings             | The Catalog item the form is connected to             |
| `site.`                                      | `{{site.name}}`          | Everywhere                                           | Your site's details                                   |
| `date.`                                      | `{{date.date}}`          | Everywhere                                           | Today's date and time                                 |
| `post.`, `term.`, `user.`, `query.`, `meta.` | `{{post.title}}`         | The form                                             | The page the form is on and the visitor viewing it    |
| `order.`                                     | `{{order.number}}`       | Email and PDF templates for WooCommerce orders (Pro) | The WooCommerce order                                 |
| `pdf.`                                       | `{{pdf.invoice_number}}` | PDF templates                                        | The document itself (number, generated date)          |

### Form tags <a href="#form-tags" id="form-tags"></a>

#### Page and visitor (`post.`, `term.`, `user.`, `query.`, `meta.`) <a href="#page-and-visitor-post-term-user-query-meta" id="page-and-visitor-post-term-user-query-meta"></a>

These are filled in on the server when the page with the form loads, so a value is fixed for that page view.

| Tag                                                                               | Shows                                                                                                                                                |
| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{{post.id}}`, `{{post.title}}`, `{{post.slug}}`, `{{post.url}}`, `{{post.type}}` | The page or post the form is on                                                                                                                      |
| `{{term.name}}`, `{{term.slug}}`, `{{term.description}}`, `{{term.link}}`         | The category or tag on an archive page                                                                                                               |
| `{{user.id}}`, `{{user.display_name}}`, `{{user.email}}`, `{{user.login}}`        | The logged-in visitor (empty for guests)                                                                                                             |
| `{{query.<name>}}`                                                                | A value from the page address, e.g. `{{query.ref}}` for `?ref=summer`                                                                                |
| `{{meta.<key>}}`                                                                  | A custom field of the page. Only keys a developer has allowed through the `craftforms_merge_meta_keys` filter are shown, so private data never leaks |

#### Site and date <a href="#site-and-date" id="site-and-date"></a>

These work in forms, emails and PDFs.

| Tag                                                                         | Shows                                               |
| --------------------------------------------------------------------------- | --------------------------------------------------- |
| `{{site.name}}`, `{{site.url}}`, `{{site.tagline}}`, `{{site.admin_email}}` | Your site's title, address, tagline and admin email |
| `{{date.now}}`                                                              | Date and time, e.g. `2026-10-02 14:30:00`           |
| `{{date.date}}`                                                             | Date, e.g. `2026-10-02`                             |
| `{{date.time}}`                                                             | Time, e.g. `14:30`                                  |
| `{{date.year}}`                                                             | Year, e.g. `2026`                                   |

#### Price and WooCommerce product tags <a href="#price-and-woocommerce-product-tags" id="price-and-woocommerce-product-tags"></a>

These appear in the `{{` menu (Info Block, dynamic field and choice labels) when the form has a Price Formula (Pro), plus a WooCommerce group on forms connected to a WooCommerce product.

| Group                           | Shown when                                                                                                                                                                                |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `form.*` price tags (1–6 below) | The form has a Price Formula (Formula & Pricing panel, Pro).                                                                                                                              |
| `field.wc_*` tags (7–9 below)   | WooCommerce is active and CraftForms Pro is enabled. They only have a value on a WooCommerce product page with a connected form, for simple products. Variable products aren't supported. |

**Why `form.*` for 1–6 but `field.*` for 7–9?** The `form.*` tags are display-only values: the finished Price Formula result and its tax breakdown. You can't use them in a formula or condition. `wc_price`, `wc_sku` and `wc_stock` are ordinary smart variables that CraftForms creates for WooCommerce products. Because of that, the same name works everywhere: as a bare name in a formula (`quantity * wc_price`), in a Field Condition, and as a `{{field.wc_price}}` display tag.

1. **`{{form.price}}`: price (calculated).** The live result of the Price Formula, recalculated as the visitor fills in the form. On a WooCommerce product page it uses the tax basis your shop displays prices in (including or excluding tax). Use tags 3 and 4 if you need one basis regardless of shop settings.
2. **`{{form.currency}}`.** The form's currency symbol. On a WooCommerce product page, the shop's currency is used.
3. **`{{form.price_incl_tax}}`: price including tax**, whatever the shop's display setting, from the product's WooCommerce tax rate. Outside a taxable WooCommerce product it equals `{{form.price}}`.
4. **`{{form.price_excl_tax}}`: price excluding tax.** Same rules as above.
5. **`{{form.tax_amount}}`: the tax portion only**, as a money amount. For example: "(VAT: {{form.tax\_amount}})".
6. **`{{form.price_suffix}}`: WooCommerce's price display suffix** (WooCommerce → Settings → Tax → Price display suffix), e.g. "(incl. VAT)". It's filled only when WooCommerce tax is enabled, the product is taxable and a suffix is set. WooCommerce's own `{price_including_tax}` and `{price_excluding_tax}` placeholders in it are filled in.
7. **`{{field.wc_price}}`: the product's current price** (the sale price while a sale is on). A smart variable named `wc_price` on the form or product overrides it.
8. **`{{field.wc_sku}}`: the product's SKU.** If the product has a Dynamic SKU expression (built from the visitor's choices, e.g. size and colour), its result is used; otherwise the product's own SKU.
9. **`{{field.wc_stock}}`: stock for the visitor's current selection.** Only when per-SKU stock tracking and a stock table are set up on the product. It shows the quantity of the stock-table row whose SKU matches `wc_sku`, or 0 if none matches.

Tags 8 and 9 are for display only. When the form is submitted, the server works out the SKU again and re-checks stock before accepting the order. The value shown in the browser is never trusted for the order itself.

### Email, PDF and action tags <a href="#email-pdf-and-action-tags" id="email-pdf-and-action-tags"></a>

#### Submitted fields (`email.`) <a href="#submitted-fields-email" id="submitted-fields-email"></a>

`{{email.<field name>}}` shows a submitted field, e.g. `{{email.name}}` or `{{email.message}}`. The menu lists the fields of the form you're working with.

File-upload fields have extra parts:

| Tag                           | Shows                                                          |
| ----------------------------- | -------------------------------------------------------------- |
| `{{email.photo}}`             | The file name(s)                                               |
| `{{email.photo.name}}`        | The file name                                                  |
| `{{email.photo.url}}`         | A download link                                                |
| `{{email.photo.image_url}}`   | An image address for an image block (JPG, PNG, GIF, WebP only) |
| `{{email.photo.2.image_url}}` | The 2nd file of a multi-file field (counting from 1)           |

#### Submission and Catalog item <a href="#submission-and-catalog-item" id="submission-and-catalog-item"></a>

| Tag                                   | Shows                                                                                                                                        |
| ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `{{submission.id}}`                   | The saved submission's ID. Filled once a **Save Submission** action has run earlier in the form's action list                                |
| `{{submission.domain}}`               | The site the form was sent from: the other site for an embedded form, otherwise yours                                                        |
| `{{submission.url}}`                  | The page address the form was sent from. For forms embedded on another site, browsers share only that site's address, not the full page path |
| `{{catalog.title}}`, `{{catalog.id}}` | The Catalog item the form is connected to                                                                                                    |
| `{{order.id}}`                        | A CraftForms Catalog order's ID (Pro). For WooCommerce orders see below                                                                      |

#### WooCommerce order (`order.`) (Pro) <a href="#woocommerce-order-order-pro" id="woocommerce-order-order-pro"></a>

These tags work in email and PDF templates used for a WooCommerce order:

* email and PDF steps in a [WooCommerce order flow](/documentation/form-building/flows.md);
* PDF documents attached to WooCommerce orders.

Together they cover everything WooCommerce shows in its own order emails. The **WC: Order Confirmation** and **WC: New Order (admin)** email starters, and the **WC: Invoice** and **WC: Packing Slip** PDF starters, use them and are a good place to start.

**Order**

| Tag                        | Shows                                  |
| -------------------------- | -------------------------------------- |
| `{{order.number}}`         | Order number                           |
| `{{order.date_formatted}}` | Order date in your site's date format  |
| `{{order.date_time}}`      | Order date and time                    |
| `{{order.date}}`           | Order date as `2026-10-02`             |
| `{{order.status}}`         | Order status                           |
| `{{order.customer_note}}`  | The note the customer left at checkout |

**Customer and addresses**

| Tag                                                                      | Shows                                                                             |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| `{{order.first_name}}`, `{{order.last_name}}`, `{{order.customer_name}}` | Customer's first, last and full name                                              |
| `{{order.customer_email}}`                                               | Customer's email. Use it as an email template's recipient to send to the customer |
| `{{order.billing_phone}}`                                                | Customer's phone                                                                  |
| `{{order.billing_company}}`                                              | Company                                                                           |
| `{{order.billing_address}}`                                              | Billing address, formatted on several lines                                       |
| `{{order.shipping_name}}`, `{{order.shipping_phone}}`                    | Shipping recipient and phone                                                      |
| `{{order.shipping_address}}`                                             | Shipping address, formatted on several lines                                      |
| `{{order.shipping_method}}`                                              | Shipping method, e.g. "Flat rate"                                                 |
| `{{order.payment_method_title}}`                                         | Payment method, e.g. "Direct bank transfer"                                       |

**Amounts.** All amounts are formatted with the order's currency.

| Tag                        | Shows                               |
| -------------------------- | ----------------------------------- |
| `{{order.subtotal}}`       | Subtotal                            |
| `{{order.discount}}`       | Discount (empty when there is none) |
| `{{order.shipping_total}}` | Shipping cost                       |
| `{{order.fees_total}}`     | Fees                                |
| `{{order.tax_total}}`      | Tax                                 |
| `{{order.refunded}}`       | Amount refunded                     |
| `{{order.total}}`          | Total                               |

**Ready-made tables**

| Tag                      | Shows                                                                                                   |
| ------------------------ | ------------------------------------------------------------------------------------------------------- |
| `{{order.items_table}}`  | Every item with its configuration (the options the customer chose) as a table: product, quantity, total |
| `{{order.items_list}}`   | The same items as a bulleted list                                                                       |
| `{{order.totals_table}}` | The totals rows WooCommerce shows under the items: subtotal, discount, shipping, payment method, total  |

For more control over the items table (columns, SKU, prices, images), add the **Order Items** block to your template instead. See [Order Items block](/documentation/email-templates/create-email-template/email-template-blocks/order-items.md).

**Links**

| Tag                  | Shows                                                     |
| -------------------- | --------------------------------------------------------- |
| `{{order.view_url}}` | The order in the customer's My Account page               |
| `{{order.pay_url}}`  | The payment page, only while the order still needs paying |
| `{{order.edit_url}}` | The order in wp-admin, for emails to the shop             |

**Order facts for conditions.** In a WooCommerce order flow, Condition steps can also test `order.total_raw` (the total as a number), `order.item_count`, `order.has_craftforms_items` (1 or 0), `order.payment_method`, `order.billing_country`, `order.shipping_country`, `order.customer_role`, `order.coupons` and `order.created_via`. These are meant for conditions, not for display.

#### PDF document (`pdf.`) <a href="#pdf-document-pdf" id="pdf-document-pdf"></a>

| Tag                      | Shows                                                                                                                                                                 |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{{pdf.invoice_number}}` | The document's sequential number, e.g. `INV-2026-0042` (Pro). Given to documents whose **Document role** is Invoice, Proforma or Credit note, once per order and role |
| `{{pdf.number}}`         | The related order's ID (WooCommerce or Catalog), otherwise the submission ID. Not the invoice number                                                                  |
| `{{pdf.order_id}}`       | The related order's ID, WooCommerce or Catalog (Pro)                                                                                                                  |
| `{{pdf.generated_at}}`   | When the PDF was created                                                                                                                                              |

### Tips <a href="#tips" id="tips"></a>

* **Use the menu.** Typing `{{` shows only the tags that work in that spot, so you can't pick one that never gets a value.
* **Order text is shown as text.** In WooCommerce order tags, values the customer typed (names, company, the order note) can't add HTML or tags to your email or PDF.
* **No loops.** Templates don't repeat a section for each item. For a list of items, use the Order Items block or the ready-made `order.items_*` tags.
* **Empty values.** A tag without a value shows nothing, so a label in front of it ("Discount: ") still appears. Put optional values on their own line, or leave them out of the template.
