Gravity Forms: How to Manage Event Quotas (and Switch Forms Automatically)

Gravity Forms allows you to limit the number of entries for a form directly in the form settings. Once the maximum number of entries is reached, the form becomes inactive and a message can be displayed.

This works well for simple use cases.

However, when managing event registrations, you often need something more flexible, for example:

  • Display the main registration form while seats are available
  • Automatically show a waiting list form once the quota is reached
  • Display a custom message when the event is full

The following snippet (to be added to your custom plugin) creates a shortcode that handles this logic dynamically.

<?php
/* 
*	Add quota and switch form if quota reached
*/
		add_shortcode('gf_quota_switch', function ($atts) {
				// default values
				$atts = shortcode_atts([
						'form_id'        => 1,  // main form
						'limit'          => 10, // max quota
						'fallback_form'  => 3,  // second form
						'message'        => 'The quota has been reached. You can leave your contact details below.'
				], $atts);		
				if (!class_exists('GFAPI')) {
						return '';
				}
				$search_criteria = [
					'status' => 'active' // ignore spam et trash
				];
				$paging = [
					'offset'    => 0,
					'page_size' => 1
				];				
				$total_count = 0;
				GFAPI::get_entries($atts['form_id'], $search_criteria, null, $paging, $total_count);				
				$count = (int) $total_count;
				if ($count < (int) $atts['limit']) {
						return do_shortcode('[gravityform id="' . $atts['form_id'] . '" ajax="true"]');
				}
				return '
						<div class="gf-quota-message">
								<p>' . esc_html($atts['message']) . '</p>
								' . do_shortcode('[gravityform id="' . $atts['fallback_form'] . '" ajax="true"]') . '
						</div>
				';
		});
?>

Usage

Simply insert the shortcode into a page like this:

[gf_quota_switch form_id="1" limit="2" fallback_form="3" message="Quota reached!"]

Parameters

  • form_id
    The ID of the primary form (e.g. the event registration form).
  • limit
    The maximum number of allowed entries.
  • fallback_form
    The ID of the form to display once the quota is exceeded (e.g. waiting list form).
  • message
    The message displayed when the quota is reached.

How It Works

  • While the number of entries is below the defined limit, the main form is displayed.
  • As soon as the limit is reached, the shortcode automatically:
    • Displays your custom message
    • Replaces the main form with the fallback form

This approach gives you full control over event capacity management without manually deactivating forms or editing pages.

It is particularly useful for:

  • Workshops
  • Paid events
  • Limited-seat trainings
  • Private registrations
  • Multi-session events

Submit a Comment

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