TutorialSet a maximum amount available for Gravity Forms Choices

Do you want to limit the availability of a Checkbox or Radio Button choice based on a maximum number the choice can be selected? For example if you have a maximum number of workshop places or products available? With the Limit Choices Add-on from Gravity Perks you can easily configure that.

How to set maximum limit per choice

Once you’ve installed and activated the Perk, you’ll have an extra configuration option available with Checkbox, Radio Button, Dropdowns and Multi Select Fields in Gravity Forms. Click ‘enable limits’ to activate it. See the example used in the demo, where we’ve set a limit of 100 to Workshop 1, a limit of 200 to Workshop 2 and a limit of 300 to Workshop 3:

Screenshot of enabling limits (maximum number a choice can be selected) for Gravity Forms select fields.
Screenshot of enabling limits (maximum number a choice can be selected) for Gravity Forms select fields.

How to display the spots that are left

GravityWiz provided a handy snippet you can easily add to your functions.php file in your WordPress (child)theme to show the number of spots left.

If you want to to change spots in something else, you can easily change the $message variable in the snippet:

$message = sprintf( _n( '(%s product available)', '(%s products available)', $count, 'gp-limit-choices' ), number_format_i18n( $how_many_left ) );

Above example will show ‘100 products available’ in stead of ‘100 spots left’. The %s automatically changes in the actual amount remaining, don’t change that.

Conditional Logic for remaining choices

How many choices are left for a specific choice can also be used to configure Conditional Logic, for example for showing a certain HTML Block if there are less then a certain amount of spots left.

How to reset the limits every day

If you want to renew the Limit Choices on a daily basis, you can use this snippet from Gravity Wiz. Don’t forget to change the form_id and the field_ids array to match the Gravity Form and Field you want to renew daily.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.