Contact Form 7 Used as a Calculator: Generator & Guide


Contact Form 7 Used as a Calculator: Shortcode Generator

Dynamically generate Contact Form 7 shortcodes to perform calculations within your WordPress forms. Build quote forms, order forms, and more.

CF7 Calculation Shortcode Generator


Enter one field name per line. These will become your form’s number inputs and the variables for your formula.


Use the field names from above to create your mathematical formula.


This will be the name of the special calculation field that displays the result.

Your Complete CF7 Shortcode

Copy the code below and paste it directly into your Contact Form 7 ‘Form’ tab.


Formula Breakdown

Your calculation formula will be generated here.

Generated Input Field Shortcodes

This table shows the individual shortcodes created based on your input field names.


Variable Name Generated Shortcode

What is a contact form 7 used as a calculator?

A “contact form 7 used as a calculator” isn’t a separate plugin, but a powerful, native feature of the Contact Form 7 plugin for WordPress. By using a special form tag called `[calculation]`, you can perform mathematical operations based on user input from other fields in the form. This allows you to transform a simple contact form into an interactive tool, such as a price quote generator, an order form with a running total, a measurement converter, or any other type of online calculator.

This functionality is perfect for businesses that need to provide instant estimates to their customers, service providers who want to create booking forms with dynamic pricing, or anyone looking to add interactive elements to their WordPress site without adding heavy, dedicated calculator plugins. The core idea is to capture numbers from fields (like `[number]`, `[select]`, or `[checkbox]`) and use them in a formula to produce a live-updating result.

The {primary_keyword} Formula and Explanation

The magic behind using Contact Form 7 as a calculator is the `[calculation]` shortcode. Its syntax is straightforward and powerful. You define a name for your result field and then provide the mathematical formula as a string.

The basic formula is:

[calculation your-result-field-name "your-formula"]

For example, to calculate a total price from quantity and price fields, the shortcode would look like this:

[calculation total-price "quantity * item_price"]

Variables Table

The variables in your formula are simply the names of the other fields in your form. It’s crucial that these names match exactly.

Variable Meaning Unit Typical Range
item_price The cost of a single item. Currency (e.g., USD, EUR) 0 – 10,000+
quantity The number of items the user is ordering. Unitless Integer 1 – 100
tax_rate A percentage value for sales tax. Percentage (%) 0 – 25
shipping_cost A flat or calculated shipping fee. Currency (e.g., USD, EUR) 0 – 500

For more complex formulas, explore one of the many advanced cf7 calculator guides.

Practical Examples

Example 1: Simple Quotation Form

Let’s create a form to calculate the cost of a service based on hours worked and an hourly rate.

  • Inputs: `service_hours` (Number), `hourly_rate` (Number)
  • Formula: `service_hours * hourly_rate`
  • Results: A field named `estimated_quote` will display the total cost.

<label> Hours of Service
  [number* service_hours min:1 max:100 placeholder "e.g., 5"] </label>

<label> Hourly Rate ($)
  [number* hourly_rate min:20 max:500 placeholder "e.g., 75"] </label>

<p>Estimated Quote: $[calculation estimated_quote "service_hours * hourly_rate"]</p>

[submit "Get Quote"]

Example 2: Product Order Form with Tax

Here, we calculate the total cost for a product, including a fixed 8% sales tax.

  • Inputs: `product_price` (Number), `product_quantity` (Number)
  • Formula: `(product_price * product_quantity) * 1.08`
  • Results: The `final_total` field shows the price including tax.

<label> Product Price
  [number* product_price placeholder "19.99"] </label>

<label> Quantity
  [number* product_quantity placeholder "2"] </label>

<p>Total (including 8% tax): $[calculation final_total "(product_price * product_quantity) * 1.08"]</p>

[submit "Place Order"]

Discover more use cases with these contact form 7 tips.

How to Use This {primary_keyword} Calculator Generator

Our generator simplifies the process of creating a calculator form. Just follow these steps:

  1. Define Your Inputs: In the “Input Field Names” box, enter the names for each variable you’ll need. For example, `width`, `height`, `price`. Put each name on a new line.
  2. Write Your Formula: In the “Calculation Formula” box, write the mathematical expression using the exact field names you just defined. For example, `width * height * price`.
  3. Name Your Result: In the “Result Field Name” box, give a name to the field that will show the final calculation, like `total_area_cost`.
  4. Copy the Shortcode: The “Your Complete CF7 Shortcode” box will automatically update with the full code needed for your form. Click the “Copy Results” button.
  5. Paste into WordPress: Go to your WordPress dashboard, open your Contact Form 7 form, and paste the copied code into the “Form” tab. Save your changes, and your calculator is ready!

Key Factors That Affect {primary_keyword}

  • Correct Field Names: The names in your formula must exactly match the names of your input fields. A small typo will break the calculation.
  • Input Field Types: Calculations work best with `[number]`, `[select]`, `[radio]`, and `[checkbox]` fields. Text fields can cause “NaN” (Not a Number) errors.
  • JavaScript on Your Site: Since CF7 calculations are performed by JavaScript, other scripts or JS errors on your page can conflict with the form and prevent it from working.
  • Plugin Conflicts: Other WordPress plugins, especially those that also use JavaScript heavily, can sometimes interfere with Contact Form 7’s functionality.
  • Theme’s Code Quality: A poorly coded WordPress theme can include buggy JavaScript that prevents the calculator from running correctly.
  • Caching Plugins: Aggressive caching can sometimes serve an old version of the form’s script. Ensure your caching plugin is configured correctly, especially when making changes. For advanced issues, a good wordpress calculator plugins guide can be helpful.

Frequently Asked Questions (FAQ)

Q: Why does my calculator show “NaN” instead of a number?

A: “NaN” stands for “Not a Number.” This typically happens when one of your input fields is empty or contains non-numeric text. Ensure all fields used in the formula are `[number]` types and have a default or entered value.

Q: Can I use currency symbols like ‘$’ in the calculation?

A: No. The formula itself should only contain the mathematical expression. You can, however, place the currency symbol directly in the form template, just before the `[calculation]` shortcode, like this: `Total: $[calculation total_cost]`.

Q: How do I handle percentages in a formula?

A: You must convert the percentage to a decimal within the formula. For example, to add a 20% tax to a `price`, your formula would be `price * 1.20` or `price * (1 + 20 / 100)`.

Q: Can the calculated result be sent in the notification email?

A: Yes! Simply add the mail-tag corresponding to your calculation field (e.g., `[total_cost]`) into the “Message Body” section of your “Mail” tab in Contact Form 7.

Q: Are complex functions like square roots supported?

A: The default `[calculation]` tag in Contact Form 7 only supports basic arithmetic (+, -, *, /). For more advanced functions, you might need a dedicated add-on plugin.

Q: How can I set a default value for an input field?

A: You can set a default value directly in the field’s shortcode. For example: `[number product_quantity default:1]`. This helps prevent “NaN” errors from empty fields.

Q: Can the calculator use conditional logic (if/then statements)?

A: Not with the standard Contact Form 7 plugin. Conditional logic requires a third-party add-on designed to extend CF7’s capabilities.

Q: Where do I find the generated shortcode to put on my page?

A: After saving your form in the Contact Form 7 editor, a blue box appears with the form’s main shortcode (e.g., `[contact-form-7 id=”123″ title=”Calculator Form”]`). You paste this shortcode onto the WordPress page or post where you want the form to appear.

© 2026 Your Company. All Rights Reserved. This calculator is for informational purposes only.



Leave a Reply

Your email address will not be published. Required fields are marked *