Computed properties (custom variables)

Written By Floris de Vries

Last updated About 1 hour ago

Computed properties (also called Custom variables) let you define your own intermediate variables in a calculator. You write a small formula once, give it a name, and then reuse the result in your main pricing formula or in conditional rules.

This keeps complex pricing readable: long expressions are broken down into smaller, well-named pieces, and a change in logic only needs to be made in one place.


Where to find them

Computed properties are configured in the Calculation / Formula step of the calculator builder, in the Computed properties section above the main formula.


What you can configure per row

  • Label โ€“ a human-friendly name for this variable (for example, Surface area, Discounted price).

  • Formula โ€“ the expression that produces the value. It can use form fields, the product price, product/variant metafields and the math helpers, exactly like the main formula.

  • Use as price variable โ€“ when enabled, the variable shows up in the formula picker so you can drop it into your main formula or into branch formulas.

  • Show as product attribute โ€“ when enabled, the value is added to the line item properties of the product. This is useful for showing intermediate values to admins, fulfillment tooling, or in the order summary.


How the variable name is built

Each computed property gets an internal key derived from the label. In formulas it is referenced as _cv_{slug}. You normally do not have to type this manually โ€“ use the Form fields picker in the formula builder and the right value is inserted for you.


Example: surface area as a custom variable

Suppose you have two number inputs called width and height and you want to charge a price per square meter, plus a fixed surcharge.

Instead of writing it all in one formula, you can:

  1. Add a computed property Surface area with formula width * height.

  2. Use that variable in your main formula:

product_price + _cv_surface_area * 12 + 25

If you later change the rate from 12 to 15, you only update the main formula. If you want to change how surface area is computed, you only update the computed property.


Conditional pricing and per-branch overrides

When you use the premium Conditional pricing mode, computed properties can be overridden per branch. This lets a single variable mean different things depending on the matched condition, while keeping a single name in your formulas.

For example, Discount can be computed as 0 in the default branch but as price * 0.1 in a branch that matches a customer tag or a quantity threshold.


๐Ÿ’ก Tip: Use computed properties to give your pricing a clear vocabulary. Variables like Surface area, Setup fee or Discount make formulas much easier to maintain than a single long expression.