Price formulas
Expression syntax, available variables and functions, rounding, and references to other price groups.
A formula is an expression using {variable} tokens and arithmetic operations. Examples:
{base_price} * 1.23
{base_price} * {currency_rate} * 1.10
{base_price} + ({product.weight} * 2.50)Expressions are calculated using decimal numbers, not floating-point numbers, so cents are not lost during rounding.
Step by step: create a formula
- Go to Catalog → Prices, on the Formulas tab.
- Click + above the list. An editor opens on the right with New formula where the name will go.
- Enter a name in the editor heading.
- Enter an expression on the Expression tab. Variables are highlighted in the field. The Variable button above the field inserts a variable at the cursor; it also lists prices from other groups (
{base_price_CODE}). - Wait a moment; the formula is validated as you type. If it is valid, you will see a sentence such as “For a base price of 100.00 and other group prices of 120.00, the result is 130.00.” Otherwise, you will see a red message from the server. You cannot save an invalid formula.
- On Advanced, check the Code (required, unique within the company; letters, digits, and
_only; generated from the name until you enter your own; editable after saving), and set Rounding and Decimal places (0–10). Description is optional. - Click Save in the footer.
- A formula does not price anything until a group uses it. In the group editor, on Calculation, choose Formula and select it as the Group formula (Prices — screen and price groups). The Groups tab in the formula editor shows which groups already use it.
The Source currency and Target currency fields on Advanced are descriptive only; calculation does not read them. {currency_rate} always means the rate from the currency of the group the formula reads to the currency of the group it prices.
Step by step: check a formula on a product
The sentence below the expression calculates using sample numbers. To check a saved formula on a real product, use the Test on product box on the Expression tab.
- Save the formula. Before saving, the box says: Save the formula to test it on a product.
- Enter the product name, SKU, or EAN and select the product from the list.
- Select the Price group to calculate in.
- Click Test.
- Read Calculated now (the formula result using current data), Saved price (the price this product currently has in that group), and Base price. If the product has no price in the group, you will see No price in this group.
Testing does not save anything; only recalculating the group changes saved prices.
Variables
| Variable | Meaning |
|---|---|
{base_price} | The Base Price for this row |
{currency_rate} | Currency conversion rate |
{product.weight}, {product.weight_kg} | Product weight |
{price_group.decimal_places} | Number of decimal places for the group |
You cannot use product cost in a formula. There is no cost column on the product, and a formula that refers to it is rejected when saved.
Access to other object fields is blocked; only the list above is allowed. This safeguard prevents a formula from being used to extract arbitrary data from the system.
References to other price groups
A formula can use the price of another price group for the same product, by name or code:
{base_price_WHOLESALE} * 1.15It retrieves the other group's effective price, applying the same precedence: override → calculated → base.
Changing a price in a source group triggers automatic recalculation of groups that depend on it, including when a missing price row must be created. Circular references (A reads B, B reads A) are detected and do not cause an infinite loop.
A group name or code cannot override the base_price and currency_rate variables; these are reserved.
Functions and operators
Available operators are +, -, *, /, **, %, and unary minus. The exponent is limited to prevent a single formula from hanging the system.
Functions: abs, round, min, max, ceil, floor, round99, ceil99, floor99.
Rounding
Methods: none, mathematical, up, down, to the nearest 5 cents, and to an ending of ,99. A price always has two decimal places, so a setting of 3 or more places is treated as 2; this ensures that “up” still means up. Calculations use decimal numbers — this is not cosmetic: with floating-point numbers, a clean price of 48.00 could end up at 48.99 instead of 47.99.
A missing exchange rate is an error, not a guess
If a formula needs an exchange rate and neither a direct nor an inverse rate exists, the formula returns an error. The system does not substitute a rate of 1; silently treating a base price of PLN 100 as EUR 100 is worse than leaving the price uncalculated and showing an error.
The rate is looked up only when the expression uses {currency_rate}. A formula with a fixed conversion factor (for example, {base_price_MAIN_PLN} / 4.3) also works without a saved rate. After rates are imported (daily from the ECB), prices in groups using either currency in the pair are recalculated automatically.
A deactivated formula does not price anything
The Active switch in the formula editor stops the formula. A group that uses it reports a failed recalculation and keeps its existing price; a workflow rule using a deactivated formula is skipped.
Test before using a formula
You can test a formula on a product before a group uses it; see the steps above. Validation also rejects expressions containing dangerous constructs or unclosed brackets.
Error messages come in English, directly from the server. Common ones include Expression cannot be empty, Unbalanced braces in expression, Undefined formula variable: '…', Dangerous keyword '…' not allowed, and, if a rate is missing, No exchange rate configured for PLN -> EUR.
This is different from attribute formulas
Calculated attributes use a separate formula language with text functions. The syntax and available functions are different; do not copy expressions between the two.
Want to see this with your orders? We’ll show you NOXTI with your sales channels and warehouse.
Book a demo