Generating Calculation Formulas With WPForms AI

AI Calculations is a Pro Feature

Unlock AI Calculations and other powerful features to grow your business.

Get WPForms Pro

Would you like to create complex calculation formulas for your WordPress forms without writing code? With the WPForms AI feature and the Calculations addon, you can easily generate calculation formulas by simply describing what you want to calculate.

This guide will show you how to use WPForms AI to generate calculation formulas for your forms.

Requirements:


Before getting started, you’ll first need to make sure WPForms is installed and activated on your WordPress site and that you’ve verified your license.

Accessing the WPForms AI Formula Generator

To start using WPForms AI for calculations, first, create your form and add all the necessary fields.

For an even smoother experience, let WPForms AI build fully functional forms for you! Just describe what you need — like a product order form that calculates totals and discounts — and WPForms AI will handle the rest. Check out our doc on generating forms with WPForms AI for more details.

When setting up your form, be sure to add clear, descriptive labels to all fields. Instead of keeping default labels like ‘Single Line Text’ or ‘Number,’ rename them to specific terms like ‘Product Price,’ ‘Quantity,’ or ‘Discount Percentage.’ This helps the WPForms AI understand better which fields to use in your calculations.

Once you’ve added all the necessary fields to your form, select the field where you want to display the calculation result. Then, go to the Advanced tab and toggle the Enable Calculation option to the ON position.

enable calculations

Creating Calculation Formulas With WPForms AI

Once the Calculation option is enabled, click Generate Formula to open the WPForms AI chat interface.

Generate formula

In the chat dialog, you’ll see a prompt asking you to describe the formula you want to create. Enter your description in the text field at the bottom of the dialog.

Enter prompt

As an example, you might enter a prompt like ‘Calculate total price based on product price and quantity combined with discount percentage’ into the text field. After that, hit the enter key or click the Send icon to proceed.

Click Send after entering prompt

WPForms AI will then generate a formula based on your description.

Generated formula

Customizing WPForms AI Generated Formulas

After WPForms AI generates a formula, you can review it and request modifications if needed. The AI will display the formula along with an explanation of how it works and which field IDs are related to the fields in your form.

For example, you might type ‘include a 5% sales tax on the final price after the discount’ into the text field. After entering your request, hit the enter key or click the Send icon.

Customizing the formula

If your modification requires a field that doesn’t exist (e.g., a sales tax dropdown), you’ll need to add it first. WPForms AI can only work with existing fields.

WPForms AI will then process your request and update the formula based on your feedback. It will also provide an explanation of the changes made to the formula.

AI generated formula

You can continue refining the formula by sending additional prompts. For example, you might also want to add more specific instructions like ’round the final result to two decimal places’.

AI generated formula

Once satisfied, click Insert Formula to apply it to your form field.

Insert Formula

Validating and Fixing Formulas With AI

Once your formula is created or modified, you might want to validate it to ensure it works correctly. To do this, click the Validate Formula button in the form builder.

If the formula is valid, you’ll see a green checkmark indicating that everything is correct.

Validate Formula

If the formula contains errors during validation, a popup with the error description will appear. Click Fix with AI to let WPForms AI resolve the issue automatically.

Fix with AI button

When the validation error is due to the use of non-existent field IDs, the Fix with AI button won’t be displayed.

After clicking Fix with AI, the AI chat interface will open again, and WPForms AI will provide a corrected formula along with an explanation of what was wrong with the original formula.

Formula fixed with AI

Once you’re satisfied with the corrected formula, click the Insert Formula button to apply it to your form field.

Click Insert Formula

Frequently Asked Questions

Below, we’ve answered some of the top questions about using WPForms AI with the Calculations Addon to generate formulas.

How does WPForms AI know which fields to use in the formula?

WPForms AI analyzes the fields in your form and uses their IDs (e.g., $F1, $F2) in the generated formula. When describing your calculation, refer to fields by their labels so WPForms AI can easily identify which fields to use.

Can I edit the AI-generated formula manually after inserting it?

Yes, once you’ve inserted the formula into your form field, you can edit it manually in the formula builder just like any other WPForms calculation formula.

What should I do if I get an error saying “The provided form structure does not include the necessary fields”?

This means WPForms AI can’t generate the formula because some essential fields are missing from your form.

For example, if you’re trying to create a sales tax calculator but haven’t added fields for the amount and tax rate, you’ll need to add these required fields to your form first.

Can I use WPForms AI to fix formulas I created manually?

Yes! If you’ve written a formula manually but it has errors, you can use the Fix with AI feature after validation fails to have WPForms AI correct the formula for you.

That’s it! You now know how to use WPForms AI to generate calculation formulas for your forms.

Next, would you like to learn how to build your own formulas? Check out our guide on building formulas with the Calculations addon for more details and use cases.

The Best WordPress Drag and Drop Form Builder Plugin

Easy, Fast, and Secure. Join over 6 million website owners who trust WPForms.

Please enable JavaScript in your browser to complete this form.