# Troubleshooting formula-based pricing

Are you using (complex) formulas, but your product’s grand total is incorrect or remains zero? Then there is a high chance your formula is wrong. Below are some tips on finding the issue.

## The basics

1. Make sure your formula really is a formula. If your formula is just a simple number, then it is not a valid formula. If you want your product price to increase with a number, you should select “flat fee” or “quantity-based flat fee” as the pricing type.
2. If you’re using functions inside your formula (such as `round` or `ceil`), make sure the functions are available in your version of the plugin. We have a “Pro” and “Extended” version and most functions are only available in our Extended version. You can see the complete list of available functions (and in which version they’re available) here.

## Dive deeper

If the above basic checks didn’t fix your issue, you can do the following checks to further debug your formula:

1. Make sure you are using sufficient brackets to group certain operations. If you don’t do it, your formula may produce unwanted results. For example, `2 * 4 + 1` is dubious because it can have 2 different results. Depending on which operation the system does first (`2*4` or `4+1`), the result of the operation can be `9` or `10`. You should instruct the system which operation to perform first by using brackets. For example `2 * (4 + 1)` results in `10` because you instructed the system to calculate `4+1` first. This way, there are no unwanted results.
2. When using functions inside formulas, make sure you use the semicolon `;` character to divide parameters. Do not use a comma.
3. Make sure there are no typos in the formula. A common mistake could be using spaces in shortcodes. For example, the shortcode to get the base product price `[price]`. Make sure it doesn’t have any spaces inside, like this `[ price ]`. It’s subtle, but notice how it has spaces around the square brackets. That’s not allowed.
4. Make sure your shortcodes to grab field values (`[field.ID]`) are pointing to fields that have a number value. For example, say you have a field of type Select that has a few options like this: `10 sqm`, `20 sqm`, `30 sqm`, etc… Then pointing to this field with the shortcode `[field.ID]` will not work because `10 sqm` is not a valid number (it is text). Leaving out `sqm` from the option text will work as the options become valid numbers then. If you can’t change the option to a valid number, you will need to use our plugin’s Variables feature to assign numbers to the different field options.
5. If you’re using long & complex formulas, try breaking it up in smaller parts first and see if that works. If a smaller part works, you know the whole formula is at fault and you can start to fine-tune which part has an error. For example, if you have a complex formula `(A + B) * (C + D)`, you can first try the formula `(A + B)`. If that works, you know the error is somewhere in the other part `(C + D)`.