How to Set Up Dynamic Pricing in Gravity Forms

Make your prices mathe-magically adapt to customer input!

  1. Let’s get mathin’
  2. Formula 1—Wood Base Price: Basic Conditional Statement
  3. Formula 2—Total Material Cost: Conditional Statement with Multiple Expressions
  4. Final Formula—Price: Conditional Statement
  5. Dynamic pricing with GP Conditional Pricing
  6. Taking it further
    1. Accepting payments
    2. Using Nested Forms to add dynamic pricing to multiple products
  7. See you later, calculator!

One of the most dubious phrases in modern society has got to be “one size fits all.” Factors like desired size, material, and even special features can be widely variable!

Luckily, if you’ve ever wanted to offer dynamic pricing in Gravity Forms, GP Advanced Calculations is the spell for you. 🪄

This perk powers up Gravity Forms’ calculation feature by adding extra formulas, field shorthands, and more. If you combine that with Gravity Forms’ built-in ability to reference fields in calculations, you can easily get the necessary customer input and generate a final price that accounts for multiple user-specified variables.

For example…

  • Custom-made cabinetry, where customers can input the dimensions they need.
  • Subscriptions like a monthly variety snack boxes that let customers choose how many items they want and the type of snacks included (e.g., premium imported treats, domestic goods, or a mix of both).
  • Personalized jewelry that adjusts prices based on the choice of metal (silver vs. gold), the number of gemstones added, and whether personalized engravings are included.

In this article, we’ll walk through a quote calculator I built for a wood deck company. It uses conditional statements to let multiple fields adjust dynamically as the form is filled out, influencing the final price. In other words, multiple variable variables varying a variable price. Tongue-twister much? 😆

This article requires the Gravity Forms Advanced Calculations perk.

Buy Gravity Perks to get this perk plus 48 other premium Gravity Forms plugins!

View Plugin Buy Now

Let’s get mathin’

Behold the Wizarding Wood Deck Estimate Calculator 2000:

Showing Gravity Forms wood deck calculator.
Beautiful, isn’t it?

The calculator calculates a full quote for wood decks, taking into consideration:

  • Total deck size (in sq/ft).
  • Type of wood.
  • Type of finishing for said wood.
  • State where deck is going to be built in.

To allow for all of those variables, I wrote three formulas. Two of them are in hidden number fields (Number Format set to Currency 😉), and the last one lives in a Product field.

Pointing out formulas and hidden fields of the wood deck calculator.

Formula 1—Wood Base Price: Basic Conditional Statement

Our first conditional statement lives in a hidden number field called Wood Base Price. It calculates the multiplier for each Wood Type and applies it to the Deck Size. If the selected wood is Pine, it’s 5x. If it’s Cedar, it’s 7x.  Composite is the last option, so it’s represented as else and it incurs a 10x multiplier.

Showing base price formula inside Gravity Forms formula field.

F1 and F2 are merge tag shorthands referencing the Deck Size and Wood Type fields respectively. Even in this simple formula, shorthands keep calculations clean and easy to follow.

Formula 2—Total Material Cost: Conditional Statement with Multiple Expressions

Our second conditional statement lives in another hidden number field. It determines the total cost of materials by using the result of the Wood Base Price (F4) and, when applicable, summing it to the additional cost of the selected Wood Finish (F3).

Showing total material cost formula inside Gravity Forms formula field.
Advanced Calculations’ syntax highlighting makes this easy to digest. It’s so pleasing to look at!

Let’s take a closer look at elseif( F3 == 'Stained' && F1 == 'Composite'):

This is a conditional statement rocking multiple expressions. It says: “if the chosen wood finish is “Stained” and the wood type is “Composite”, apply this more expensive fee.” Stained is usually just 2 for Pine and Cedar, but it’s 4 for Composite.

Pro-tip: Always put the more specific conditional statements first in the conditional cascade.

Final Formula—Price: Conditional Statement

The last piece I needed to take into consideration for the final price was the different base labor fee for each state. It applies yet another conditional multiplier, this time to Total Material Cost (F5).

Showing final price formula inside Gravity Forms formula field.

As you can see, this formula is located in a Product field! If you set the Field Type to Calculation, you can take advantage of Advanced Calculations in Product fields as well. 🪄

Here’s the Wizarding Wood Deck Estimate Calculator 2000 in action, with the hidden fields appearing from beyond the veil:

Demonstrating wood deck calculator in action.

Ghostbusters!

I recorded this GIF using GP Live Preview. It’s super useful to see hidden fields when building a form-based calculator… a form-ulator!

Dynamic pricing with GP Conditional Pricing

GP Conditional Pricing also offers dynamic pricing, but with a different method: it uses static pricing levels, which is good for use cases like bulk pricing or early bird pricing.

If, let’s say, you sold prefab decks of each wood type and the price varied based on thresholds (e.g., $500 up to 100 sq/ft), Conditional Pricing would work well.

Check out one of our customers using Conditional Pricing’s secret bulk price importer, or this other customer who accommodated 25,000 pricing levels in a booking form.

Advanced Calculations, on the other hand, shines when prices are influenced by multiple variable factors from the form (ya know, variable variables). It’s also useful if you want to calculate your values. 🧮

Sometimes you might even want to combine the two, like one of our customers did with this quote calculator for highly customizable products.

Taking it further

Accepting payments

If you want to use dynamic pricing for collecting payments directly, you can use one of Gravity Forms’ payment gateway add-ons. We have a guide explaining payment gateways and giving a down-to-(middle)-earth overview of all options you have available in Gravity Forms.

All of them require at least one Pricing field—so just include the final calculation in a Product field and you’re good to go. 🧙

Using Nested Forms to add dynamic pricing to multiple products

To let customers order multiple products that need dynamic pricing in a single form, you can use GP Nested Forms.

Example: If this wood deck business provided different types of decks (like conventional decks, wraparound decks, and pool decks), they could have one child form for calculating the price of each deck, then use the :total merge tag modifier to return the sum of all child entry order totals.

To get a visual of this idea, check out How To Set Up Conditional Pricing with Nested Forms, where Scott demonstrates this concept using Conditional Pricing.

See you later, calculator!

That’s all from me today, wizards! If you want to see how far the formula rabbit-hole can go, check out these two Spotlights where our customers built a wonderful land income calculator and a heavy-duty free estimate calculator by combining Advanced Calculations with GP Populate Anything.

For any questions, hit us up in the comments!

Comments

    1. Samuel Bassah
      Samuel Bassah Staff March 21, 2025 at 1:42 pm

      Hi Paul,

      The functionality of the form should be the same whether it’s embedded on a WooCommerce Product page or not. So, it should work as it is. If you experiencing anything different, please submit a ticket via our support form so we can look into the issue.

      Best,

Leave a Reply

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

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.


Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.