Common Formula Errors and How to Fix Them
Getting unexpected prices or formula errors?
The most common issues merchants run into with the Custom Price Calculator formula, and how to fix each one.
Price shows $0
Cause: the formula is returning 0, usually because an input is not connected properly or is being read as empty.
How to fix it:
- Open your calculator in the CPC editor.
- Check that every element used in the formula has a matching label.
- Make sure the formula references the label exactly — spelling, spaces and punctuation all have to match. Capitals do not:
widthandWidthare the same field. - Test by entering values in every required field.
Price shows NaN
Cause: something in the formula is not a number — usually an empty optional field, or a reference to an element that returns text.
How to fix it: make the field required so it cannot be left empty, or give it a default value. A Text Input can never be used in a formula; if a choice affects price, it has to be a Dropdown, Radio, Image Selector or Checkbox with a value attached.
"Invalid formula" when saving
Cause: the formula uses something the engine does not accept.
How to fix it:
- Check element labels character by character, especially any with spaces.
- Use only the supported operators:
+-*/parentheses, and the comparisons><>=<===!=. - Use only the supported functions:
ceil(),ceiling(),floor(),sqrt(),if(),max(),min(),and(),or(). These can be nested. round(),abs(),pow()and^are not available.- Never write a
Math.prefix —ceil(Width), notMath.ceil(Width). - One calculation cannot reference another. Write the full logic out in each formula.
The preview is more forgiving than the save gate, so a formula can look fine in preview and still be rejected. The save gate is the one that counts.
Cart still shows the base variant price, not the calculated price
Cause: on the non-variant flow, Shopify's cart template always renders the original variant price on the line. The subtotal and the amount charged at checkout are correct.
How to fix it: nothing to fix — the per-line display is controlled by Shopify, not the app. If the charged amount is wrong, that is a different problem; contact support with your store URL.
If you have just changed theme, hard-refresh first. Cached theme assets can keep showing the old behaviour.
How do I set a minimum price?
There are two different settings, and picking the wrong one is a common source of confusion.
Minimum Value, on an individual input, stops a customer entering a width below 10 or a quantity below 1. It works per field, not on the total.
Minimum Formula Value, in the calculator's settings, floors the finished price. This is what you want for "no order under $25". It also fixes the "calculator shows 0.00 before anything is entered" problem, which matters if Google Merchant Center is rejecting the product.
You can also floor the price inside the formula:
max(Width * Height * Rate, 25)One trap: Minimum Formula Value floors the whole result, so an add-on fee can be swallowed on small orders until the total climbs above the floor. If that bites, set minimums on the input fields instead so the formula reaches the floor naturally.
Price has too many decimal places
Cause: the result is not being rounded for display.
How to fix it: set Formula Output Decimals to 2 in the calculator's settings. There is no round() function — this setting is how money gets rounded.
For rounding to whole units of material rather than currency, ceil() and floor() work inside the formula.
How do I use the Shopify product price in my formula?
Use the reserved variable shopify_product_price. It pulls the product's own price in, so one calculator can serve hundreds of products at different prices:
shopify_product_price * Metersshopify_price is not a real variable and will fail validation.
A flat base price plus calculated add-ons
Add the base as a number:
50 + (Width * Height * Rate)Or use the product's own price as the base:
shopify_product_price + InstallationFrequently asked
My cart shows the wrong price. See "Cart still shows the base variant price" above.
My total can still go below the amount I want. You are probably using the field-level Minimum Value. Use Minimum Formula Value in the calculator's settings, or wrap the formula in max().
My formula looks right but returns NaN. An optional field is empty. Make it required, or give it a default.
Can I charge a different rate above a certain size? Yes — if(Width > 45, 85, 0) added to your formula. For three or more bands, a Data Lookup in range mode is easier to maintain.
Still getting unexpected results?
Send support your store URL and the product page, and say what you expected versus what you saw. Attaching the formula itself saves a round trip.
Updated on: 20/08/2026
Thank you!