🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials October 19, 2026

Gravity Forms Calculations and Conditional Logic: The Complete Guide (2026)

GravityExtra
Gravity Forms Calculations and Conditional Logic: The Complete Guide (2026)

Gravity Forms calculations turn a plain form into a quote tool, a price calculator or an order form. A visitor picks a quantity, enters a date or types an address, and the total updates before they press submit.

This guide covers the whole topic in one place: formula functions, AND/OR conditional logic, tax and discount lines, distance and ZIP zone pricing, text length pricing, merge tag modifiers, dynamic data and quote PDFs. It is written for site owners and developers who build price-driven forms and want to know which GravityExtra add-on solves which problem.

What Gravity Forms Does Out of the Box (and Where It Stops)

Out of the box Gravity Forms already gives you a lot. Number and product fields can calculate with plus, minus, times, divide and brackets. Conditional logic can show or hide fields, pages, notifications and confirmations. Product, Option, Quantity, Shipping and Total fields build an order that the official payment add-ons can charge.

Where it stops is anything that needs a decision or outside data. A formula with an “if” in it will not work. You cannot say “the larger of two values”, round inside a formula, or count how many boxes are ticked. Conditional logic matches all or any of the rules in one list, but you cannot nest AND and OR groups. There is no built-in tax or discount line, no price that changes by quantity tier, and no price by distance or text length.

The add-ons below fill those gaps without custom code. Every price is calculated again on the server when the form is submitted, so a visitor cannot change a total in the browser.

Gravity Forms Calculations With if, min, max and Rounding

Use this when a price depends on a condition: a bulk discount, a minimum charge, a rounded total or a cap. The add-on is Logic & Math Pro, and its documentation lists every function.

Example: charge an hourly rate, with 10 percent off when the job is longer than 10 hours.

  1. Activate your license key under Forms, Settings, Logic & Math. Leave the function groups switched on.
  2. In the form editor, add a Number field called Hours and a Number field called Rate.
  3. Add a third Number field called Price. Tick “Enable Calculation”.
  4. Above the formula box, open the “Insert function” drop-down to add functions, and “Insert date or choice field” to add Date, Checkboxes or Multi Select fields.
  5. Type the formula: if({Hours:1} > 10, {Hours:1} * {Rate:2} * 0.9, {Hours:1} * {Rate:2}). Your field IDs will differ.
  6. Click “Validate Formula”. Unknown functions and wrong argument counts are rejected.

The visitor sees the Price field change as they type, and the same formula is evaluated on the server at submission. The other functions are min, max, sum, round with decimals, floor, ceil, abs, pow, sqrt, mod, and, or and not.

Dates and choices work the same way. A Date field becomes a day number, so days_between, age, weekday and today give you nights stayed or age in years. A Checkboxes or Multi Select field adds up the selected choice values, and count returns how many are ticked. Fields hidden by conditional logic count as 0.

Tip: the functions work in Number fields with calculation and in Calculated product fields. They do not work in text or hidden fields. Division by zero returns 0, not an error.

Conditional Logic With AND/OR Rule Sets

Use this when one show or hide rule is not enough, for example “show the discount section if the customer is a member AND the order is over 100, OR a coupon is entered”. The same Logic & Math Pro add-on adds named rule sets that you build once and reuse.

  1. Open the form, then Form Settings, Logic & Math, Rule sets.
  2. Add a rule set and give it a name, such as “Large member order”.
  3. Choose the match type for the group: “All of these (AND)” or “Any of these (OR)”.
  4. Add conditions. Pick a field, an operator such as “contains”, “is empty”, “at least” or “date is between”, and a value. For the right side you can compare with a value, another field, or today plus or minus days, weeks, months or years.
  5. Add a nested group for the OR part. You can nest up to five levels below the root.
  6. Open the conditional logic of any field, page, submit button, notification, confirmation or add-on feed. In the field list of a rule, choose “Rule set: Large member order” with “is” and “matched”.

The visitor only sees the result: a section appears, a page is skipped or a notification is sent. On the server, a field hidden by a rule is not validated or saved, even if the browser posts a value.

Tip: the add-on also offers age comparisons, such as “age at least 18”, and a “matches pattern” operator. Patterns are limited to a safe subset so they cannot slow your site down.

Gravity Forms Pricing Fields: Tax, Discount, Quantity Tiers and Price Ranges

Use this for order forms that need a Subtotal, Tax or Discount line, a lower unit price at higher quantities, or limits on a “User Defined Price” product. The add-on is the Pricing Fields Pack. See the documentation for details.

Example: a product with a quantity discount and a 20 percent tax line.

  1. Go to Forms, Settings, Pricing Fields and switch on the features you need. They are off by default.
  2. In the form editor, add a Single Product field and a Quantity field. Then add a Tax field from the Pricing Fields group.
  3. On the Tax field, set “Tax type” to Percentage, “Tax rate” to 20 and “Apply to” to All products. Tick “Also charge tax on shipping” if needed.
  4. Add a Discount field if you want a fixed or percentage reduction. You can apply it to all products or only selected ones.
  5. Open Form Settings, Pricing Fields and switch on conditional pricing for the form.
  6. On the product card, add Quantity tiers: “Minimum quantity” 10 with “Unit price” 8, and “Minimum quantity” 50 with “Unit price” 6.

The visitor sees a “Your price” note under the product and a live total. Tax and discount lines go into the Gravity Forms order itself, so the Total field, the entry order summary and payment add-ons all show the same amounts.

Price rules go further than tiers. Each rule reads “when this field is, is not, greater than or less than a value, the price is X”, and the first matching rule wins. For a User Defined Price product, set “Minimum price” and “Maximum price”, and show the allowed range under the field.

Tip: one condition per rule. The pack has no AND/OR groups for prices and does not include coupons.

Distance and ZIP Zone Pricing

Use this for delivery, moving, cleaning, towing or any service that travels to the customer. The add-on is Distance & Location Pricing, with its own documentation. It needs a Google Maps Platform account.

  1. Go to Forms, Settings, Distance Pricing. Activate your license and paste a server key (Routes API) and an optional browser key for address suggestions. Use the Test buttons.
  2. In the form editor, add a Distance field from the Pricing Fields group.
  3. Set “Starting point” to “Business address” and enter your address, or choose “Address entered in another field” for pickups.
  4. Pick the unit (miles or kilometers), what to show customers, and tick “Round trip” if the distance should double.
  5. Open the Pricing & Area tab and tick “Charge for distance”. Enter a “Base fee” of 25, “Price per mile / km” of 2 and “Charged beyond” 10.
  6. In “Zone surcharges”, add one line per prefix in the format prefix, a vertical bar, then the surcharge. For example 787|10.
  7. Under Service area, set a “Maximum one-way distance” and optionally “Allowed ZIP / postcodes”.

With those numbers, a 15 mile trip costs 25 plus 5 times 2, which is 35, plus any zone surcharge. The distance price is added as a product line, so Stripe, PayPal and other payment add-ons charge it. Outside the service area the visitor sees your message and cannot submit.

You can also use distance tiers, a flat price per band, and a “Minimum charge”. Merge tags such as {distance:ID}, {distance_duration:ID} and {distance_price:ID} work in notifications.

Tip: results are cached for 24 hours by default, which keeps your Google costs down. If Google is unreachable the form cannot be submitted, so nobody is charged a wrong price.

Text Length Pricing and Slider Inputs

Use text length pricing for translation, proofreading, writing or print services where the price follows the amount of text. The add-on is Text Length Pricing, and the documentation has recipes.

  1. Activate your license under Forms, Settings, Text Pricing.
  2. Add a Paragraph field for the text and a Single Product or Hidden product field for the price.
  3. Open Form Settings, Text Pricing and switch on “Use text length pricing on this form”.
  4. On the product card, switch on “Price by text length”. Tick the field to count under “Count from”.
  5. Set “Count” to Words, “Price per unit” to 0.08, “Starting price” to 5 and “Units included in the starting price” to 100.
  6. Add “Volume rates” if long texts get a lower rate. Choose “Rounding”, a “Minimum charge” and a “Maximum charge”.

The visitor sees a live line such as “123 words, $12.30” under the text field. You can count words, characters, characters without spaces or lines, and you can add up several fields.

For number inputs, the Field Utilities Pack shows a Number field as a slider. Open the field’s Appearance tab, choose “Display as a slider” and set Step, Prefix, Suffix and tick marks. The slider writes to the real input, so calculations and conditional logic update while the visitor drags. It also has a List field whose rows follow a number, shuffled choices and searchable drop downs.

Tip: sliders cannot be used on a Number field that has a calculation.

Merge Tag Modifiers, Order Summaries and Quote PDFs

Calculated values are only useful if customers see them clearly. Three add-ons handle that.

Advanced Merge Tags lets you chain modifiers after a field ID, separated by a vertical bar. Examples from the add-on: {Hours:5:mul(15)|money} multiplies and formats as money, and {Start date:3:dateadd(2 workdays)|dateformat(l, F j)} adds working days and formats the date. It also has {gx:today} and {gx:calc:…} for arithmetic in notifications and confirmations.

Order Summary adds a live summary beside the form. Add the Order Summary field from the Pricing Fields group, then switch on the product table under Form Settings, Order Summary to turn products into a compact table with quantity steppers.

The Quote PDF add-on creates a numbered, itemised quote from product and calculation fields. Here is a short set-up.

  1. Go to Forms, Settings, Quote PDF and enter your business name, address, logo and “Paper size” (A4 or US Letter).
  2. Open Form Settings, Quote PDF and add a feed. Give it a “Document title” and a “Quote number” pattern, and set “Valid for (days)”.
  3. Choose “List the product fields”, and add “More lines from number or calculation fields” for your calculated totals.
  4. Set a “Tax name” and “Tax rate (%)” if needed.
  5. Under “Attach the quote PDF to these notifications”, pick the customer notification.

The customer receives the PDF and a private quote page where they can accept or decline. Staff see the quote status in the entry. The built-in fonts cover Latin alphabets only.

Dynamic Data and Repeating Rows

Dynamic Populate fills choices and values from your own data, so prices can come from a post, a user, an entry or an API. In the form editor, open a field and switch on “Populate this field dynamically”. Choose a “Source”, then set “Choice label”, “Choice value” and “Choice price (product fields)” with tokens like {post_title}. Filters can read other fields, and the choices refresh live when those fields change.

For repeating items, Repeater adds rows to a form. Check the product page for the version you install, because newer versions add row totals that feed parent calculations.

Comparison of GravityExtra Add-ons for Gravity Forms Calculations

Add-on What it does Price Link
Logic & Math Pro Formula functions and AND/OR rule sets $39/yr View add-on
Pricing Fields Pack Subtotal, Tax and Discount fields, quantity tiers, price ranges $39/yr View add-on
Distance & Location Pricing Price by driving distance, tiers and ZIP zones $39/yr View add-on
Text Length Pricing Price by words, characters or lines $39/yr View add-on
Field Utilities Pack Sliders, list rows from a number, randomizer, searchable drop downs $39/yr View add-on
Advanced Merge Tags Chainable modifiers for text, dates and numbers $39/yr View add-on
Order Summary Live order summary and product table $39/yr View add-on
Quote PDF Itemised quote PDF with online accept and decline $39/yr View add-on
Dynamic Populate Fill choices and values from posts, entries, tables or APIs $39/yr View add-on
Repeater Repeating rows inside a form $39/yr View add-on
Date/Time Calculator Listens for changes in Date and Time fields so date-based calculations can update $39/yr View add-on

How to Choose

Start with Logic & Math Pro if your problem is a formula or a show/hide rule. Start with the Pricing Fields Pack if you sell products and need tax, discounts or tiers. Start with Distance & Location Pricing or Text Length Pricing if the price follows something the visitor enters, such as an address or a text.

Add later: Order Summary for a clearer checkout, Advanced Merge Tags for better emails, and Quote PDF once you want to send formal quotes.

  • Do you need a decision or a minimum in a formula? Logic & Math Pro.
  • Do you need tax, discount or quantity tiers? Pricing Fields Pack.
  • Does the price depend on an address? Distance & Location Pricing.
  • Does the price depend on text length? Text Length Pricing.
  • Do customers need a formal quote? Quote PDF.

Frequently Asked Questions

Can visitors change the calculated price in their browser?

No. Gravity Forms recalculates calculation fields on the server, and the add-ons in this guide recalculate their own prices there too. The browser only shows a preview.

Do my existing formulas change when I install Logic & Math Pro?

No. Formulas that only use plus, minus, times, divide and brackets are left to Gravity Forms exactly as before. The add-on only takes over formulas that use its functions.

Can I combine AND and OR in one condition?

Yes, with a rule set. Each group is either AND or OR, and you can nest groups up to five levels. Then pick the rule set in any conditional logic list.

Will tax and discounts reach my payment add-on?

With the Pricing Fields Pack, tax and discounts are part of the Gravity Forms order, so payment add-ons read the same total. Distance prices are also added as a product line.

Does distance pricing need Google?

Yes. Distances come from the Google Maps Platform Routes API, so you need your own Google account and a server key. Address suggestions need an optional browser key.

Do I need all of these add-ons?

No. Each one works on its own. Most price forms need only one or two, and you can add more as the form grows.

Get the Add-ons

Each add-on is $39/yr. Start with Logic & Math Pro and the Pricing Fields Pack, or browse the full catalogue.

If you need several add-ons for one price calculator, such as formulas, tax lines, distance pricing and a quote PDF, the All-Access pass is simpler than buying each one separately.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr