The formula editor appears throughout the calculator editor wherever a calculation is needed — option pricing, variables, fixed fees, price adjustments, weight, and the total price formula. You can find formula fields in Calculator Editor → Options & Pricing. Each formula editor has three modes accessible via tabs at the top: Manual (type formulas directly), Describe with AI (generate a formula from plain English), and Explain formula (get a plain-English breakdown of an existing formula).
These functions pull values from options, variables, and tables into your formulas. All string arguments must use double quotes — OPT("WIDTH") is correct, OPT(WIDTH) is not.
| Function | Description |
|---|---|
OPT("KEY") |
The option's computed value — the result after any formula on that option has run. For switch options, returns TRUE or FALSE. |
INPUT("KEY") |
The raw value the customer entered. Only works for numeric-like options: number, slider, quantity, length, area, volume, and weight. |
INPUT("KEY", "dim1") |
A single dimension from a dimensions option. Use the stable tokens "dim1", "dim2", "dim3" for each dimension in order. |
VAR("KEY") |
A calculator variable defined in the Variables section. Also: VAR("BASE_PRICE") — your Initial Price base in dollars (fixed or variant). System / product variables: VAR("SHOPIFY.PRICE"), VAR("SHOPIFY.UNIT_PRICE"), VAR("SHOPIFY.QUANTITY"), and VAR("META....") metafield aliases where configured. |
HAS("OPTION_KEY", "CHOICE_KEY") |
Returns TRUE when a choice option (dropdown, radio, button, checkbox group, swatch, image swatch, switch) has the specified value selected. |
COUNT("OPTION_KEY") |
The number of selected values (0 to N) in a multi-select option such as a checkbox group. |
CHARCOUNT("KEY") |
The character count of a text or textarea option's input. Use this instead of LEN(INPUT(...)). |
TABLE("name", rowKey, colKey) |
Looks up a value from a pricing table. Supports an optional fourth argument for match mode: "exact", "nearestLower", "nearestUpper", "nearest", or "interpolate". |
OPT vs. INPUT: Use
INPUTwhen you need the raw entered value — for dimension math or unit conversions. UseOPTwhen you need the option's computed result after its own formula has run.
| Operator | Description |
|---|---|
+ - * / |
Add, subtract, multiply, divide |
% |
Modulo (remainder) |
^ or ** |
Exponent (power) |
== != |
Equal, not equal |
< <= > >= |
Comparison |
&& |
Logical AND |
|| |
Logical OR |
( ) |
Group expressions to control evaluation order |
| Function | Description |
|---|---|
IF(condition, then, else) |
Returns then when condition is true, otherwise else. |
AND(a, b, ...) |
Returns TRUE when all arguments are true. |
OR(a, b, ...) |
Returns TRUE when at least one argument is true. |
NOT(x) |
Returns TRUE when x is false, and vice versa. |
| Function | Description |
|---|---|
ABS(x) |
Absolute value of x. |
MIN(a, b, ...) |
Returns the smallest value. |
MAX(a, b, ...) |
Returns the largest value. |
CLAMP(x, min, max) |
Bounds x between min and max. |
SQRT(x) |
Square root of x. |
POWER(x, y) / POW(x, y) |
Raises x to the power of y. |
EXP(x) |
e raised to the power of x. |
ROOT(x, n) |
Nth root of x. |
SIGN(x) |
Returns -1, 0, or 1 depending on the sign of x. |
SUM(a, b, ...) |
Adds all arguments. Non-numbers are treated as 0. |
| Function | Description |
|---|---|
ROUND(x, n) |
Rounds x to n decimal places. |
CEILING(x) |
Rounds x up to the nearest integer. |
FLOOR(x) |
Rounds x down to the nearest integer. |
TRUNC(x, n) |
Truncates x to n decimal places without rounding. |
| Function | Description |
|---|---|
LEN(text) |
Number of characters in text. |
CONCAT(a, b, ...) |
Concatenates values together as a string. |
The default mode. Type your formula directly into the editor. The formula is evaluated in real time and the result appears in the live preview. The editor supports autocomplete — as you type, it suggests option keys, variable names, and function names.
Switch to the Describe with AI tab to generate a formula from a plain-English description:
The AI uses your calculator's current options and variables as context, so it can reference them by name.
Switch to the Explain formula tab when you have an existing formula you want to understand:
This is useful when reviewing formulas written by someone else, or when revisiting a complex formula you wrote previously.
Both Describe with AI and Explain formula consume AI credits from your plan allowance. Simple requests use fewer credits than complex ones. Monitor your usage on the Subscription page.
Area-based pricing — multiply two dimension inputs to get square footage, then apply a rate:
INPUT("WIDTH") * INPUT("HEIGHT") * 0.50
Dimensions option — calculate area from sub-dimensions and convert square inches to square feet:
INPUT("DIMENSIONS", "dim1") * INPUT("DIMENSIONS", "dim2") / 144
Using a variable — reference a calculator variable in the total formula and add option contributions:
VAR("AREA") * 50 + OPT("MOTOR") + OPT("FINISH")
Conditional pricing with HAS — charge a premium rate when a specific material is selected:
IF(HAS("MATERIAL", "PREMIUM"), VAR("AREA") * 1.25, VAR("AREA"))
Table lookup — pull a per-square-foot rate from a pricing table:
TABLE("price_per_sqft", INPUT("WIDTH"), INPUT("HEIGHT"))
Table lookup with interpolation — get smoothly interpolated rates between table rows:
TABLE("rates", INPUT("LENGTH"), INPUT("WIDTH"), "interpolate")
Minimum price enforcement — set a $25 price floor:
MAX(25, INPUT("QTY") * 2.50)
Multi-select surcharge — add $5 for each topping selected:
COUNT("TOPPINGS") * 5
Per-character pricing — charge per character of engraving text:
CHARCOUNT("ENGRAVING_TEXT") * 0.75
OPT vs. INPUT — INPUT("LENGTH") is the raw number the customer typed, while OPT("FINISH") is the dollar amount computed by the Finish option's formula:
INPUT("LENGTH") * 2 + OPT("FINISH")
Shopify variant price — start from the storefront variant price and add option contributions:
VAR("SHOPIFY.PRICE") + OPT("SIZE") + OPT("COLOR")
Calculator initial price (base) — same idea using the configured Initial Price (fixed or variant) via VAR("BASE_PRICE"):
VAR("BASE_PRICE") + OPT("SIZE") + OPT("COLOR")
See Initial Price (Base Price) for when to prefer BASE_PRICE vs SHOPIFY.PRICE.
Describe with AI — You type: "Price is width times height times $3.50 per square foot, minimum $50." The AI returns: MAX(50, INPUT("WIDTH") * INPUT("HEIGHT") * 3.50).
Explain formula — You paste IF(HAS("FINISH", "MATTE"), VAR("AREA") * 4.25, VAR("AREA") * 3.75) and switch to Explain formula. The AI responds: "If the Finish option is set to Matte, multiply the area by $4.25; otherwise multiply by $3.75."