---
title: Step wizard
description: The wizard config format that the admin wizard builder saves, and how the StepWizard3 and StepWizard4 reference components use it.
---

A wizard is data: steps, fields, conditions and pricing. Merchants edit it in the admin wizard builder, and your frontend decides how to present it. This page is the contract between the two, so you can design a wizard against it and let merchants maintain the steps and options afterwards.

## Products and entries

A saved wizard's `config` is a **list of product entries**. Each entry is self-contained: its own field ids, `pricing` and `steps`, plus `id`, `name` and an optional linked `product`. The wizard also has an `allow_multi_product` flag.

- Entries are never merged. Field ids only need to be unique inside one entry.
- Everything below describes one entry. Price, visibility and validation are always evaluated per entry.
- How entries are presented is up to your frontend. For example: a first step where the customer picks 0 to N units of each product, then one set of steps per product; or one unit of each product with no picker; or entries shown side by side. Combining entries (quantities, a combined total) is your code's job.

`StepWizard3` and `StepWizard4` (from `bolder-blocks`) are **reference consumers** of a single entry: they take it as their `config` prop, render a multi-step form, price it live and emit a `confirm` event. They ignore keys they don't use (`id`, `name`, `product`). Use them, copy them, or write your own on the same format. `StepWizard4` only adds a live SVG preview.

> Nothing validates the config at runtime. An unknown factor type prices to 0 and an unknown field type renders nothing. Check your config against this page and exercise it in the component.

## Shape

```
config
├─ title, returnUrl, showConfirmation, showTotalsInSidebar
├─ labels{}                      UI strings (override any default)
├─ pricing                       { locale, currency, discountRate, baseLabel, factors[] }
├─ steps[]
│   └─ { id, title, description, visibleIf, type?, fields[], rows[], paths[], ... }
│       └─ fields[]              { id, type, label, required, default, visibleIf, ... }
└─ preview                       StepWizard4 only
```

Every `field.id` is a key in the entry's `answers` object, and pricing and conditions refer to fields by that id. Two fields with the same id share one answer, so **ids must be unique across all steps of an entry** (not just within a step). Ids use letters, numbers and underscores, start with a letter (formulas use them as identifiers), and `quantity` is reserved. The admin builder enforces this and updates every reference when you rename a field.

`quantity` is the number of units of the product (default 1). Conditions, `formula` and `lookup` factors read it like an answer, so you can do volume tiers: `{ "type": "lookup", "field": "quantity", "ranges": [{ "upTo": 9, "amount": 100 }, { "amount": 80 }] }`.

## Top level

| Key | Default | Notes |
|-----|---------|-------|
| `title` | entry `name` | Shown at the top of the step list. |
| `steps` | required | Ordered list of steps. |
| `pricing` | none | Without `pricing.factors` no price is shown. |
| `labels` | English defaults | Any of `back`, `continueLabel`, `confirm`, `selectPlaceholder`, `stepProgress` (`{current}`/`{total}`), `booleanTrue`, `booleanFalse`, `totalLabel`, `discountLabel`, `includesTitle`, `startOver`, `confirmedTitle`, `returnLabel`. |
| `showTotalsInSidebar` | `true` | `false` hides the running total until a `summary` step. |
| `showConfirmation` | `true` | `false` skips the built-in "confirmed" screen, for when the host redirects to payment on `confirm`. |
| `returnUrl` | none | Adds a "Done" link on the confirmed screen. |

## Steps

| Key | Notes |
|-----|-------|
| `id`, `title`, `description` | `id` is required and unique. |
| `visibleIf` | Condition. A step whose condition fails is skipped, and the step counter adapts. |
| `fields[]` | Inputs for this step. The Continue button stays disabled until every visible `required` field has a value. |
| `type: 'summary'` | Recap/payment step. Enables `rows`, `paths`, `includes`, and the final price block. |

Only on `summary` steps:

| Key | Notes |
|-----|-------|
| `rows[]` | `{ label, field, visibleIf? }`: recap lines showing the answer to `field`. `rowsLabel` titles the block. |
| `showPrice` | `false` hides the price block (for a quote-only step). |
| `priceTitle`, `includes[]`, `includesTitle` | Heading and bullet list under the price. |
| `paths[]` | Final choices, see below. `pathsLabel` titles the block. |
| `confirmation` | `{ title, message, timeline: [{label, time}], note }` for the confirmed screen. |

## Fields

Common keys: `id`, `type`, `label`, `required`, `default`, `visibleIf`.

| `type` | Extra keys | Answer value |
|--------|-----------|--------------|
| `radio` | `options: [{ value, label, description, icon }]`, `layout` (`icon-cards`, `icon-cards-wide`, `icon-cards-slider`), `cols` | the option's `value` |
| `select` | `options: [{ value, label }]` | the option's `value` (parsed as a number when numeric) |
| `dependentSelect` | `dependsOn` (a field id), `optionsMap: { <parent value>: [strings] }` | one of the strings; reset when the parent changes |
| `catalog` | `options: [{ value, label, description, price, badge, disabled }]`; or `groupBy` + `catalog: { <group value>: [options] }`; `extraOptions` appended to either | the option's `value`. `price` feeds `catalog` pricing factors |
| `range` | `min`, `max`, `unit` | number |
| `number` | none | number |
| `text`, `email` | `placeholder` | string |
| `boolean` | `trueLabel`, `falseLabel` | `true` / `false` |

`radio.icon` is raw SVG markup. For `catalog` with `groupBy`, changing the group field clears the selection.

## Conditions

Used by `visibleIf` (steps, fields, rows) and `when` (pricing factors). One condition is an object; an array means all must match.

```json
{ "field": "locationType", "equals": "building" }
[{ "field": "locationType", "equals": "building" }, { "field": "visitorParking", "equals": false }]
```

Operators: `equals`, `notEquals`, `in` (array), `notEmpty` (`true`), `gte`, `lte`, `gt`, `lt` (numeric).

## Pricing

```json
"pricing": {
  "locale": "es-CL",
  "currency": "CLP",
  "discountRate": 0.10,
  "baseLabel": "Installation",
  "factors": [ ... ]
}
```

The total is the sum of all factor amounts. `discountRate` (0 to 1) is applied on `summary` steps. Amounts are whole units of the currency.

Each factor can have `when` (condition; fails means 0) and `label`. Factors sharing a `label` are grouped into one line of the breakdown; unlabeled factors are summed under `baseLabel`.

| `type` | Keys | Amount |
|--------|------|--------|
| `flat` | `amount` | `amount` |
| `perUnit` | `field`, `rate`, `threshold` (default 0) | `max(answer - threshold, 0) * rate` |
| `diff` | `fields: [a, b]`, `rate` | `abs(answer_a - answer_b) * rate` |
| `catalog` | `field` | the selected option's `price` |
| `formula` | `expression` | see below |
| `lookup` | `field`, `ranges: [{ upTo, amount }]` | `amount` of the first range where `answer <= upTo`; the last range omits `upTo` |

**Formula** expressions allow numbers, identifiers, `+ - * /`, parentheses and `.`. Every numeric answer is available by its field id; numeric properties of the selected option are available as `<fieldId>__<prop>` (for example `selectedModel__price`). The result is rounded.

### Server-side pricing

The client total is for display only. If you charge based on it, **recompute it on your server** and ignore what the browser sends.

- For a wizard saved in the admin builder, the shop prices a list of items. Each item names a product, a quantity and that product's answers:

  ```http
  POST /wizards/:id/price.json
  { "items": [
      { "product_id": 10, "quantity": 2, "answers": { "width": 100, "material": "pvc" } },
      { "product_id": 11, "answers": { "color": "grey" } }
  ] }
  ```
  ```json
  { "items": [
      { "product_id": 10, "quantity": 2, "subtotal": 370000, "discount": 37000, "total": 333000 },
      { "product_id": 11, "quantity": 1, "subtotal": 50000, "discount": 0, "total": 50000 }
  ], "currency": "CLP", "subtotal": 420000, "discount": 37000, "total": 383000 }
  ```

  `product_id` is the catalog product linked to the entry (the builder requires a link before a wizard can be active). Answers are per item, so field ids can repeat across products. Each item is priced per unit, then multiplied by `quantity`. To configure two units of the same product differently, send two items with the same `product_id`. It prices the saved config, never one the browser sends. Errors answer 422 `{ "error": ... }`: unknown `product_id`, invalid `quantity` or items, or items in different currencies. Invalid JSON answers 400.
- For a config you keep in your own code, port `factorAmount` (`wizard-core.js`) to your backend. The reference integration (`bolder-prototypes`, `checkout/scenarios/*.rb`) does this in Ruby, line for line. A factor type added to the engine must be added to your copy too, or it silently prices to 0 there.

## Paths and the `confirm` event

A `summary` step can offer `paths`: the final choices (pay in full, book a visit, ...).

```json
{
  "id": "visit",
  "label": "Technical visit only",
  "description": "...",
  "price": { "type": "fixed", "amount": 9990 },
  "resultMessage": "You booked the visit for {{price}}."
}
```

`price.type` is `fixed` (`amount`), `total` (subtotal) or `discountedTotal`; the last two accept a `multiplier`. Messages can use `{{price}}`, `{{total}}`, `{{discount}}`.

When the user confirms, the component emits `confirm`:

```js
{ answers: { ...by field id }, quantity, pathId, path, price }   // pathId/path/price only when paths exist
```

Use this to create the order or open checkout. The built-in confirmed screen is shown only when there is no path, or the chosen path costs 0.

## Using it

```html
<step-wizard3 :config="config" :quantity="2" @confirm="onConfirm"></step-wizard3>
```

`quantity` is optional (default 1). The price shown is per unit; multiply by the quantity yourself, or let the server do it with the pricing endpoint above.

`StepWizard3` and `StepWizard4` are registered components of `bolder-blocks` (`src/shops/`). `bolder-prototypes` shows a working Vue 3 mount for each.

## Building your own UI

The engine behind the components is exported from the SDK as `wizard`: plain functions, no framework. Keep the answers in your own state and call them to get visibility and prices that match the server.

```js
import { wizard } from 'bolder-storefront'

const answers = wizard.buildInitialAnswers(entry.steps)
const ctx = wizard.withQuantity(answers, 2)        // adds the reserved `quantity`

wizard.activeSteps(entry, ctx)                     // steps whose visibleIf matches
wizard.visibleFields(step, ctx)                    // fields whose visibleIf matches
wizard.catalogOptions(entry, field, ctx)           // options for a catalog field
wizard.subtotal(entry, ctx)                        // also discountAmount, finalTotal, priceBreakdown
wizard.pathPrice(entry, path, ctx)                 // price of a summary-step path
```

`entry` is one product entry. Source of truth: `src/shops/wizard-core.js` in `bolder-blocks`, copied into the SDK by `scripts/vendor_wizard_core.sh`.

## StepWizard4 preview

`StepWizard4` accepts an optional `preview` block that maps answers to a live SVG drawing (a window elevation: frame plus up to three panes). It reads field ids you name, for example `widthField`, `heightField`, `openingField`, `colorField` and `colorHexMap`. With no `preview` it degrades to the plain form. The keys are specific to the window drawing today; see `src/shops/StepWizard4.vue` and its test for the exact set.

## Editing in the admin wizard builder

The wizard builder saves the format on this page, one entry per product tab. Everything above is editable in it except `preview`:

- Steps and `summary` steps (`rows`, `paths`, `includes`, `confirmation`), with `visibleIf`.
- All field types, including `textarea`, `dependentSelect`, `catalog` with `groupBy` option groups and `extraOptions`, radio `layout` / `cols` / `icon`, and boolean labels.
- Conditions with several rules (all must match) and the `in` operator, for steps, fields and pricing factors.
- `pricing` and all six factor types.
- Per entry: `title`, `labels`, `returnUrl`, `showTotalsInSidebar`, `showConfirmation`. The wizard-level "Allow multiple products" switch sets `allow_multi_product`.

Keys the builder doesn't know about, such as `preview`, are not editable there. Keep them in your own code and merge them over the saved config. The builder is the authority for everything else.

## Reference

- Engine: `src/shops/wizard-core.js` in `bolder-blocks` (every rule above lives there).
- Example config: `defaultConfig()` in `src/shops/StepWizard3.vue`.
- Specs: `test/step-wizard3.test.js`, `test/step-wizard4.test.js`.
- Full integrations with server-side pricing: `bolder-prototypes`, `checkout/scenarios/` (`ev_charger.rb`, `window_configurator.rb`, `kitchen_counter.rb`, `custom_prints.rb`).
