Formulas
The Formulas tab holds the price formula of the product.
Price formula
The price formula calculates the price from the field values.
js
[width] * [height] / 10000 * 25This charges 25 per square meter when width and height are in centimeters.
By default the result is added to the product price (the variant price). You can turn this off in Settings. Taxes and currency conversion are handled by Shopify as usual.
Below the formula, click a chip to insert a field or an operator where the cursor is.
Info
The docs use plain numbers for prices. The amount is in your store's currency.
Reference a field
Write the field name between brackets: a field named width is [width]. The app replaces it with the field value.
For a dropdown or radio field, the value of the selected option is used. See Field options.
Text values must be in double quotes:
js
STRLEN("[engraving]")This applies to text, text area, date and color fields, and to dropdown or radio fields that have a text option value. The chips below the formula already add the quotes for you.
A field that is hidden by a condition counts as 0 (or empty text).
Special values
| Value | What it is |
|---|---|
[quantity] | The quantity used for the price. 1, or a quantity break. |
[product_price] | The price of the product variant. |
Operators
| Operator | Meaning |
|---|---|
+ - * / | Add, subtract, multiply, divide |
^ | Power: 2 ^ 3 is 8 |
% | Remainder: 7 % 3 is 1 |
= != <> | Equal, not equal |
< <= > >= | Compare |
& | | And, or |
! | Not |
( ) | Group |
A comparison gives 1 when true and 0 when false. You can multiply by it:
js
[width] * [height] / 10000 * 25 + ([glass] = 1) * 30Examples
Round up the area to the next whole square meter:
js
CEIL([width] * [height] / 10000) * 25Charge at least 1 square meter:
js
MAX([width] * [height] / 10000, 1) * 25Charge at least 50:
js
MAX([width] * [height] / 10000 * 25, 50)Charge per letter of an engraving:
js
STRLEN("[engraving]") * 0.5See all formula functions.
Errors
A formula that uses an unknown field or can't be read is refused when you save. The message says what is wrong and opens the tab.
