A formula lets the price depend on what the customer enters or picks. A customer types a length and a width, and the app multiplies them by your price per square meter and adds the result to the product price. You don't need a separate value or variant for every possible size.

You build the formula on the Calculations tab of an option set from three kinds of building blocks:

Then you choose what to do with the result: add it to the product price or subtract it from the product price.

Example. The formula Width * Length * 4.99 with Increase price $:

Product price Customer enters Formula result Price in the cart
$10.00 Width 2, Length 3 2 × 3 × 4.99 = 29.94 $10.00 + $29.94 = $39.94

What you can use in a formula

Options

Below the editor, Available options lists the options of the set that you can use in the formula. Click an option to add it to the formula.

Option type What goes into the formula
Number field, where the customer enters a width, length and so on The number the customer entered
Option where the customer picks a value (swatch, dropdown, buttons and so on) with Enable formula-based pricing turned on The Calculation variable of the value the customer picked

Options of other types, and select options without Enable formula-based pricing, don't appear in Available options.

Math operators and functions

Button What it does Example Result
+ Addition 2 + 3 5
- Subtraction 5 - 3 2
* Multiplication 2 * 3 6
/ Division 6 / 3 2
^ Exponentiation (power) 3 ^ 2 9
√ Square root √ 9 3
` x ` Absolute value: the number without its sign
MAX The larger of two values. Use it for a minimum price MAX(12, 20) 20
MIN The smaller of two values. Use it for a maximum price MIN(720, 500) 500
CLAMP Keeps a value between a minimum and a maximum CLAMP(720, 20, 500) 500
Round Rounds a value to the number of decimal places you set Round(22.456, 2) 22.46
CEIL Rounds a value up to the next whole number. A whole number stays as it is CEIL(21.25) 22
FLOOR Rounds a value down to a whole number FLOOR(21.75) 21
( ) Parentheses: calculate this part first (2 + 3) * 4 20
, Separates the values inside MAX, MIN, CLAMP and Round MAX(x, 20) —
π The number pi, about 3.14159 π * 2 6.28…
Const A fixed number you type in, such as your price per unit 4.99 4.99

How many values each function takes:

Function Values Order
MAX(a, b) 2 Any order
MIN(a, b) 2 Any order
CLAMP(x, min, max) 3 The value, then the minimum, then the maximum
Round(x, n) 2 The value, then the number of decimal places
CEIL(x) 1 —
FLOOR(x) 1 —

In all of them, a, b and x can be a number, an option or a whole calculation, for example MAX(Length * Width * 15, 20).

Order of operations