Articles on: Building Calculators

Conditional & Advanced Pricing: Charging Different Prices Based on Customer Input

This guide is the hub for every "how do I charge more when…" question — surcharges past a threshold, different rates per option, tiered pricing, and area-based rates. It shows which tool fits each, and the two mistakes behind most wrong-price tickets.


If you would rather describe the pricing than build it, Calcy writes the calculator from a plain-English description.


Start with a condition in the formula


Formulas can branch. if() takes a condition, a value when it is true, and a value when it is false:


Width * Height / 144 * 4.50 + if(Width > 45, 85, 0)


That charges $4.50 per square foot and adds an $85 oversize fee once the width passes 45 inches. For two rates rather than a surcharge:


if(Width > 45, 85, 65)


Conditions combine with and(), or() or &&, and if() calls can be nested:


if(Width > 45 && Height > 45, 120, 0)


Comparisons available: > < >= <= == !=. You can write = for equals and <> for not-equals if that is the spreadsheet habit.


Use if() for one or two conditions. Past that it gets hard to read and harder to change — see the table below.


Which tool for which rule


Your rule

Use

A fee or rate that changes past one or two thresholds

if() in the formula

Three or more price bands

Data Lookup in range mode, or ranges on a Number input

A different rate per selected option

Dropdown, Radio or Image Selector with a value per option

An optional add-on fee

Checkbox

A rate that depends on two inputs at once

Data Lookup


You can also show or hide any element based on another input — see Conditional display at the end.


What the formula supports


Operators+ - * / and parentheses, plus the comparisons above.


Functionsceil(), ceiling(), floor(), sqrt(), if(), max(), min(), and(), or(), and you can nest them.


Not supportedpow(), round(), abs(), and ^ for exponentiation.


Rounding money — set Formula Output Decimals to 2 in the calculator's settings. There is no round().


Shopify base price — the reserved variable is shopify_product_price. There is no shopify_price.


Element names in a formula must match their labels' spelling, spaces and punctuation exactly. Capitals do not have to match.

Recipe 1 — A surcharge past a threshold


"Charge $4.50/sq ft, and add a $15 cutting fee only when width is over 60 inches."


The short way:


Width * Height / 144 * 4.50 + if(Width > 60, 15, 0)


/144 converts square inches to square feet.



The other way, still useful when the fee has several steps, is the range feature on a Number input: on the Width element define ranges that return a value — up to 60 returns 0, above 60 returns 15 — and reference that value by the element's name:


Width[actualvalue] * Height / 144 * 4.50 + CuttingFee


A Number input in range mode gives you both forms: LabelName returns the range's value, LabelName[actualvalue] returns the number the customer typed. Use the typed number for the area, the range value for the fee.


Recipe 2 — A different rate per selected option


"Premium fabric costs $4.00/sq ft, standard costs $2.50/sq ft."



Use a Dropdown (or Radio or Image Selector) and give each option its own value — Standard 2.50, Premium 4.00. Mark it for use in the formula as Rate:


Width * Height / 144 * Rate


Because the selected option is the number, nothing needs maintaining when a price changes — edit the option value.


Do not try to read a material name from a text field. Price on the selected value, never on free text. This is the fix for the recurring "can I price based on what they type" question.


Recipe 3 — An optional add-on fee


"Add $100 for installation if the customer wants it."


Use a Checkbox. Unchecked 0, checked 100, labelled Installation:


shopify_product_price + Installation


Recipe 4 — Several price bands


"1–10 units at $9, 11–50 at $7, 51+ at $5."


This is where if() stops being the right answer. Three nested conditions are hard to read and worse to edit six months later. Use a Data Lookup in range mode instead: one row per band, with the quantity as the input, and reference the lookup by name in your formula. Changing a price is then editing a cell, not rewriting a condition.


The same applies to any rate that depends on two inputs at once — width against height, say. A lookup holds a grid; a formula would need a condition per cell.


The two mistakes behind most wrong-price tickets


A label that does not match. width and Width are different. If a formula will not save, check the element names character by character before anything else.


Pricing on free text. A Text Input returns text, and formulas return numbers. If a choice affects price, it has to be a Dropdown, Radio, Image Selector or Checkbox with a value attached.


Conditional display


Showing and hiding elements is separate from pricing. Conditional Display can reveal a field when another one has a particular value, but it does not change a rate on its own — the rate still comes from your formula or your lookup.



If a hidden element is part of the formula, set its Value when not displayed to 0 so the price does not jump while the page loads.

Updated on: 20/08/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!