Pricing
Pricing Configuration
Pricing configuration for every field and option: fixed, percentage, formula, flat fee, or per-quantity. Customers see live totals as they select options.
Pricing types overview
| Type | How it works | Example |
|---|---|---|
| Fixed | A flat amount added to the price | Gift wrap: +£3.00 |
| Percentage | A percentage of the base product price | Insurance: +10% of product price |
| Formula | A math expression using {base}, {qty}, or another field's value | Leg upgrade scaled to width: {field:ID} * 0.5 |
| Flat fee | Fixed price regardless of quantity | Setup fee: always +£10, even if buying 5 items |
| Per quantity | Price multiplied by the cart quantity | Monogram: +£2 per unit in cart |
| None | No price impact | Gift message text: £0.00 |
Fixed pricing
The simplest pricing type. Enter an amount — that amount is added to the product price when this option is selected.
- Used for: gift wrap, engraving, warranty, accessories
- Value: any decimal number (positive to add, negative to discount)
Percentage pricing
The price is calculated as a percentage of the base product price. The add-on price changes if the base product price changes.
- Used for: insurance, extended warranty, handling fee as % of order
- Value: a number representing the percentage (e.g.,
10for 10%)
Example: Product price £50, add-on at 10% → adds £5.00. If the product price is £100, the same add-on adds £10.00.
Formula pricing
Write a math expression using placeholders in curly braces. The formula is evaluated in real time as the customer changes field values, and again server-side when the price is calculated — the exact same evaluator both times, so what you see in the preview is what gets charged.
The evaluator supports the four basic operators (+ - * /) and parentheses for grouping — nothing else. There is no MAX(), MIN(), or any other function, and no conditional (if/ternary) logic inside a formula. Anything the evaluator doesn’t recognize — an unknown placeholder, a stray letter, a function call — makes the whole formula evaluate to $0.00 silently, with no error shown anywhere. Test every formula against the live preview after saving it, not just by reading it back.
Available placeholders
| Placeholder | Description |
|---|---|
{base} |
The product's base price. |
{qty} |
The quantity in the cart. |
{field:ID} |
The numeric value of another field in the same group, referenced by its real numeric field ID — e.g. {field:93}. Works with a custom_price field, a checkbox (1 when checked, 0 when not), or any radio/dropdown option whose own value is a numeric string. |
Finding a field's ID
The group editor doesn’t display field IDs directly today. Save the group once, then fetch GET /wp-json/saue/v1/addons/{group_id} (see the REST API reference) — each field in the response includes its real id, which is what you put after the colon in {field:ID}.
Formula examples
# Leg upgrade priced at half the selected table width
# (field 90 is illustrative — use your own field's real ID)
{field:90} * 0.5
# Flat setup fee plus a per-unit charge
5.00 + ({qty} * 1.00)
# 15% of the product's base price
{base} * 0.15
Per-option pricing (Walnut, +$80.00) and formula pricing (the leg upgrade scales with the selected width) both feeding the same live total — captured on the live Smart Add-Ons demo store.
Live price preview
As the customer selects options, the product price shown on the page updates in real time. This is handled by the PricePreviewController which calls the POST /saue/v1/price-preview REST endpoint to calculate the total server-side.
- Works with classic and block checkout themes
- Debounced: waits 300ms after the customer stops typing before recalculating
- Shows a loading indicator while calculating
- Falls back gracefully if the REST endpoint is unreachable
Per-option pricing (radio, dropdown, image select, checkbox group)
For multi-option fields, each option can have its own independent price. When a customer selects an option, that option’s price replaces any previous selection’s price.
- Option A: Wood — +£0.00
- Option B: Metal — +£15.00
- Option C: Acrylic — +£8.00