How to Setup Bulk Pricing with a Calculated Unit for Gravity Forms

Many products offer bulk pricing or some other conditional pricing structure. This can be used to encourage customers to purchase more of the product or to make the purchasing process easier on both owner and customer.

In this tutorial, we will combine the power of Gravity Forms with two of our Perks, GP Conditional Pricing and GP Copy Cat, to build a form that can conditionally calculate a price per unit based on the number of units being purchased.

Let’s get started!

Steps

  1. Create a Height Field
  2. Create a Width Field
  3. Create a Calculated Unit Field
  4. Create a Product Field
  5. Copy Calculated Unit to Product Quantity Field (with GP Copy Cat).
  6. Create Pricing Rules Based on Quantity (with GP Conditional Pricing).

1. Create a Height Field

Let’s add a Number field to the form where the user will input the desired height.

gp-conditional-pricing-height-fieldAdd a Height Field

2. Create a Width Field

Add a second Number field to the form where the user will input the desired width.

gp-conditional-pricing-width-fieldAdd a Width Field

3. Create a Calculated Unit Field

Add a third Number field. This will be a calculated number. This is achieved with two simple steps.

  • Check the “Enable Calculation” option.
  • Specify your formula using the “Insert Merge Tag” drop down. We are calculating square footage so we will multiply the height field by the width field.
conditional-pricing-demo-enable-calculationMultiply the Height by the Width via Merge Tags

Hiding the Calculated Unit
In many cases, you may want the calculated unit to determine the total price; however, you do not wish the calculated unit to be visible to the user. You can hide any field from view by adding the “gf_hidden” class to the Custom CSS Class field setting.

4. Create a Product Field

Add a Product field. The price of this field will be dynamically set via the pricing rules you will configure in Step 6. The label of the field does not impact the functionality. We’ve labeled our product “Material”. The more material that is ordered (based on our calculated unit) the lower the price.

gp-conditional-pricing-product-fieldAdd a Product Field

5. Copy Calculated Unit to Product Quantity Field (with GP Copy Cat).

We want our calculated unit (i.e. the total square footage of material we are ordering) to be applied as the quantity of our Material product field. Gravity Forms doesn’t support calculated quantities by default. This is why we have our calculated unit as a separate calculated Number field.

With GP Copy Cat, we can copy the value of that Number field to the Quantity input of our Material product field.

  • Install and activate GP Copy Cat.
  • Open the Square Footage field settings.
  • Select the “Appearance” tab.
  • Enter the Copy Cat class to copy the value of the Square Footage field to the Material’s Quantity input. Based on our field IDs, the class would be: copy-18-to-20.3

The first number (18) is the ID of the field we are copying from (Square Footage) and the second number (20.3) is the input ID of the input we are copying to (quantity).

Learn more about using GP Copy Cat here.

add-copy-cat-class

Use GP Read Only to set Quantity as read only. This would prevent the user from modifying the Quantity manually.

6. Create Pricing Rules Based on Quantity (with GP Conditional Pricing).

Lastly, we will configure the conditional pricing rules for the form. Conditional Pricing will allow us to modify the price of the Material product based on how much Square Footage is being purchased.

  • Install and activate GP Conditional Pricing.
  • Select “Conditional Pricing” from the Form Settings menu.
  • Select the Material product field from the “Select a Product” drop down.
  • Create your first pricing rule.
  • Click the “Add New Pricing Level” button to create additional pricing rules for this product.

Here is how we’ve configured our pricing rules for the demo.

conditional-pricing-product-variationsConditional Pricing setup from the demo

What questions do you still have?

Do you still have any questions about how to get this setup? We’d love to know what they are. Let us know!

Comments

  1. Brian
    Brian October 8, 2020 at 1:25 pm

    This is looking pretty close to what we want, but would it work with Drop Down Products so that different materials can have different pricing conditions? Example:

    Material 1: Price is $1.00 if quantity is less than 10 Price is $.90 if quantity is less than 20 Price is $.80 if quantity is less than 30 Price is $.75 if quantity is less than 40 Price is $.70 if quantity is 40 or more

    Material 2 (premium material): Price is $1.50 if quantity is less than 10 Price is $1.40 if quantity is less than 20 Price is $1.30 if quantity is less than 30 Price is $1.20 if quantity is less than 40 Price is $1.00 if quantity is 40 or more

    Reply
    1. brian
      brian October 9, 2020 at 9:18 am

      Thanks for your response. I’m looking at the demo on this particular tutorial and some of the functionality isn’t making sense to me. Why is the quantity box being auto filled? And why does it change as I change sizes?

      What we are trying to accomplish Stickers, posters, etc -Enter width -Enter height -Select Material (different price for different materials with conditional pricing on each) -Select Quantity

      Conditional pricing should be based on total square units. So whether they order 1,000 stickers at 2″ x 2″ each (4,000 sq inches) or 40 stickers at 10″ x 10″ each (4,000 sq inches) the price will be the same because it will fall into whatever pricing condition is set for 4,000 sq inches.

    2. Samuel Bassah
      Samuel Bassah Staff October 9, 2020 at 11:06 am

      Hi Brian,

      This tutorial is specific to a use case where the square foot of material is used as the quantity for the Product. The quantity field is being auto-filled because of the copy cat class that is used to copy the calculated square foot within the Number field into the Quantity field.

      You’re free to set up your form in a different way, such that your users will manually enter the quantity and you will still be able to use the GP Conditional Pricing to determine the price of the product based on the quantity entered.

      If you’re a Gravity Perks License holder, you can send us an export of the form via our support form so we can take a closer look at your form setup and further assist you.

      Best,

    1. David Smith
      David Smith Staff September 27, 2019 at 12:08 pm

      Hi Mustaqim, I’ve responded to your email requested more details on how you envision this feature working.

  2. Brijesh Nandani
    Brijesh Nandani November 16, 2017 at 9:13 am

    Hello,

    I’m hoping to find a solution for this. It’s something similar to this setup. Here’s what I am looking to achieve.

    I have a list field and a Yes/No Drop-down in the list field using this plugin: https://wordpress.org/plugins/gravity-forms-list-field-select-drop-down/

    The list field will be used to add drivers and each driver will have a drop-down in the row to select from Yes/No

    The Yes/No is basically an up-sell product.

    So I need to find a way to calculate the number of “Yes” in the list field and copy that to the quantity field of the up-sell product (Maybe using your awesome GP copy-cat perk or maybe with dynamic population)

    I’ve looked around a lot but haven’t found anything yet. Hope I was able explain myself.

    Reply
    1. Brijesh Nandani
      Brijesh Nandani November 16, 2017 at 4:37 pm

      Is this something possible in GF at all?

      If yes, can you let me know where to look at or guide me about custom code?

      Thanks for your help!

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.