How To Set a Min/Max Quantity on Single Product Fields in Gravity Forms
Have you ever needed to set a minimum or maximum quantity for Product fields in Gravity Forms? If you’re selling a product that requires a minimum order or you want to limit the quantity for a single order, this tutorial is for you.
Getting Started
Setting a min/max range is simple with Number fields, however Product fields don’t support it. Fortunately, Quantity fields behave just like any other Number field, so you can set a min/max range on them.
Steps
Step 1 – Add a Quantity Field
Start by adding a separate Quantity field to the form.
Step 2 – Map Quantity Field and set Min/Max
Map the separate Quantity field to your existing Product field. You can then set a min/max range on the Quantity field.
Step 3 – Disable Quantity in Product Field
With a separate Quantity field in place, disable the Quantity field within the Product itself. Otherwise, you’ll end up with two Quantity fields on the form.
That’s It!
With the Min/Max in place on the Quantity field, users will be limited to the range you have set. If the form is submitted with a number outside of that range, they’ll see a validation error on submission.
Taking it Further
Rounding by Increments
Our Rounding by Increments snippet can automatically enforce min/max ranges and it will let you set the range on a Product field without the need for a separate Quantity field. Simply add the gw-round-min-n
and gw-round-max-n
classes to the Appearance tab for the Product field and the snippet will handle enforcement.
With the classes in place, the snippet will replace any value outside of the range with the next valid value.
Quantity Based Pricing
Pair this technique with GF Conditional Pricing to set up quantity based pricing and charge different amounts based on the number of products your customers order.
For example, say you have a shop that sells face masks in bulk to businesses. You could require a minimum order of 10 masks and also offer a discount if the order quantity is higher than 40. Check out our article on How to Setup Bulk Pricing with Gravity Forms for more info.
greeting is there any possiblity to add dynamic populated multiple product checkboxes with their corresponding quantity in gravity forms? So each product has its own quantity. Regards
Hi Revo,
Unfortunately, this isn’t possible. To have different quantity input fields for different products, you’ll need to use a Single Product field. Choice based product fields use one quantity input field for all the choices.
A possible workaround will be to use this tutorial to create a checkbox product field. https://gravitywiz.com/checkbox-products-gravity-forms/
Best,
Is there a way to make the minimum apply only if a number has been entered?
e.g. Allow the form to be submitted if the linked quantity field has been left empty or has a zero entered.
If the field is empty, the minimum is ignored. We don’t have a ready solution for also allowing zero to bypass the minimum but we do provide minor customizations like this for our Pro customers if you’re interested. 🙂
Is there anyway to set a “maximum” quantity, so that if you are only offering “4” of a specific type of product… once the form is submitted 4 times, it will automatically be removed from the options? Thanks!
Hi Mike,
This is possible with our GP Inventory Perk. You can check out the documentation for more information on this. https://gravitywiz.com/documentation/gravity-forms-inventory/
Best,
I tried this but my format show us very clunky. Please see my test form. How do I get mine to look less clunky like yours?
Hi Chris,
I’m not really tracking your question very well. If you have an active Gravity Perks license, you can send us a message via our support forms with an export of your form so we can take a closer look at your setup.
Best,