Articles on: Building Calculators

Common Formula Errors and How to Fix Them

Getting unexpected prices or formula errors?


Here are the most common issues and how to fix them.


Price shows $0

Cause: The formula is returning 0, usually because an input field isn't 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 or variable name.
  • Make sure the formula references the exact field label (including capitalization).
  • Test the calculator by entering values in all required fields before clicking Add to Cart.


Price shows NaN (Not a Number)

Cause: The formula is trying to perform calculations on a non-numeric value, such as a text field or an empty input.
How to fix it:

  • Add a fallback value of 0 for optional inputs. For example, use (Width || 0) × (Height || 0) × Rate.
  • Make required fields mandatory so they can't be left blank.
  • Avoid using dropdown labels directly in calculations. Instead, use a data lookup element.


"Invalid formula" error when saving

Cause: There's a syntax error in the formula, such as mismatched parentheses, unsupported operators, or a reference to a field that doesn't exist.
How to fix it:

  • Check that every opening parenthesis has a matching closing parenthesis.
  • Make sure field names match the element labels exactly, especially if they contain spaces.
  • Use only supported operators (+, -, *, /, ^) and supported math functions such as ceil(), floor(), round(), max(), and min().


Price has too many decimal places

Cause: The formula result isn't being rounded.
How to fix it:

  • Use the round() function in your formula. For example, round(Width × Height × Rate, 2) rounds the result to two decimal places.
  • Alternatively, set Formula Output Decimals to 2 in your calculator settings.


How do I use the default Shopify product price in my formula?

Use the reserved keyword shopify_price in your formula. This automatically pulls the selected Shopify variant's price.
Example: shopify_product_price × Quantity


I want a flat base price plus calculated add-ons

Use shopify_price as your starting price, then add your calculated values.
Example: shopify_product_price + (Width × Height × Rate)


Still getting unexpected results?

If you're still having trouble, send us the following and we'll help troubleshoot your calculator:

  • Your formula.
  • The element labels used in the calculator.
  • The result you're getting and the result you expected.

Updated on: 26/07/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!