Close a webform when total seats reach a maximum
I built a custom handler to process seat reservations. I just wanted to share my code for anyone else looking to do the same thing. @jrockowitz let me know if you want to add this into webform core.    

&lt;?php
namespace Drupal\webform_reservations\Plugin\WebformHandler;


use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformHandlerBase;
use Drupal\webform\webformSubmissionInterface;

/**
* Form submission handler.
*
* @WebformHandler(
* id = "webform_reservations_handler",
* label = @Translation("Reservations Handler"),
* category = @Translation("Form Handler"),
* description = @Translation("Manage maximum seat reservations"),
* cardinality = 
 \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_SINGLE,
* results = \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
* )
*/

class ReservationHandler extends WebformHandlerBase {


 /**
 * {@inheritdoc}
 */

  public function submitForm(array &amp;$form, FormStateInterface $form_state, 
  WebformSubmissionInterface $webform_submission) {
  $webform = $webform_submission-&gt;getWebform();
  $formid = $webform-&gt;id();

//query the db for all submissions of current webform submission
$query = \Drupal::entityQuery('webform_submission');
$query-&gt;condition('webform_id', $formid);
$result = $query-&gt;execute();

//load all the submissions from the results
$storage = \Drupal::entityTypeManager()-&gt;getStorage('webform_submission');
$submissions = $storage-&gt;loadMultiple($result);
$submission_data = array();


foreach ($submissions as $submission) {
$submission_data[] = $submission-&gt;getData();
}

$current_reserved = 0;

//add up all the values in the 'seats needed' field of each submission and save it to a variable.     
for ($i = 0; $i &lt; count($submission_data); $i++){
    $current_reserved += $submission_data[$i]['seats_needed'];
}

//when a registration form is submitted, check if the current reserved seats exceeds the value specifed in the maximum allowed seats field of the form.
if ($current_reserved &gt;= $webform-&gt;getElement('max_seats')['#value']) {
    $webform-&gt;setStatus('closed');
    $webform-&gt;save();

 $message = 'The form has ' . $current_reserved . ' reserved seats, the max seats is currently set to ' . $webform-&gt;getElement('max_seats')['#value'] .  ' the form will now be closed';        
  } else {$message = 'The form has ' . $current_reserved . ' reserved seats, the max seats is currently set to ' . $webform-&gt;getElement('max_seats')['#value'] .  ', the form will stay open';}        

//log the output to the drupal logger, to indicate if the webform is still open or closed after each submission.        
\Drupal::logger('webform_reservations')-&gt;info($message);    

}    
}
?&gt;