Loading...

Your privacy choices

Google Analytics 4 measures site visits and Google Ads measures advertising clicks and checkout completions, only for the purposes you accept. Neither is required to buy. Necessary checkout services remain available.

Your privacy choices

Google Analytics 4 measures site visits and Google Ads measures advertising clicks and checkout completions, only for the purposes you accept. Neither is required to buy. Necessary checkout services remain available.

These optional Google services may set audience or advertising cookies after your acceptance. Analytics and advertising are separate choices. Acceptance and refusal are remembered in this browser for a fixed 180 days, without extending the period when read. You can withdraw or change your choices at any time using Privacy choices in the footer. Withdrawal removes optional first-party Google cookies and reloads the page if Google has already loaded (using session storage in this tab if persistent storage refuses the withdrawal; a blank page opens only if both stores cannot safely record the withdrawal and a stale approval remains). Checkout, external demos, videos, support and newsletter services have their own privacy information.

Calculate a price

Calculate prices and quantities with formulas

Create price formulas with the value picker, arithmetic and conditions. Understand unit prices and test quantity, rounding and branch changes.

Updated v10.6.772 min read
On this page
Where to find it

Edit component → Price → Price calculation or Quantity calculation

Practical video guides

English narration and captions

Build accurate dynamic prices

Combine a base price with a distance slider, keep choices exclusive and check the calculation with known values.

Before you start

Write the business rule in plain language and calculate two expected results by hand. Add the input fields first. Use the editor’s value picker so references match the IDs in your form.

Price formula editor with value, condition, distance and date difference toolsOpen full-size screenshot
Enable Price calculation to open the formula editor; insert references with Add a value. Screenshots use the English plugin interface; translated labels can differ.

Step-by-step instructions

  1. Open the calculation for the intended result: price, quantity or a variable. Use Add a value to insert a field value, item price, quantity or variable.

  2. For a price calculation, assign the result to [price]. Use +, -, * and / with parentheses where needed. Write decimal constants with a dot, independently of the displayed currency format.

  3. Add a condition through the editor to insert the correct comparison tokens. Set a default result before conditional overrides so every path assigns a value.

  4. Save and test with zero, minimum, typical and maximum inputs. Go back and change dependent fields. Protect divisions against zero and round only at the intended stage.

Example: base fee plus area

For a base fee of 50 and a rate of 12.5 per square metre, 8 m² gives 150. The example uses item 1 only as an illustration: replace its token with the area field selected through Add a value. Keep the priced component quantity at 1 for this total-fee example.

Code
[price] = 50 + ([item-1_value] * 12.5);

Example: minimum charge

Assign the base result, then apply a minimum. For 2 units at 12.5, this returns 50; for 8 units, it returns 100. This is an item price example, before other items, coupons or taxes.

Code
[price] = [item-1_value] * 12.5;
if ([price] < 50) {
    [price] = 50;
}

Check the result

Compare expected item prices with the summary and final total. When quantity is 3 and the unit price is 20, the line total must be 60, not 180. Test a cleared input and a deselected option as well.

If it does not work

Check the result token, field IDs, decimal notation and whether quantity is applied twice. Avoid circular dependencies. The calculation editor is for supported formulas; browser APIs, network calls and arbitrary application scripts are not a pricing rule.