Is it possible that a selection from a drop-down menu becomes unavailable after a certain number of bookings?

I am taking ticket bookings and they are in batches and I would like to have certain batches become unavailable after a certain amount of bookings.

Thanks for your help

  • how do you fill the drop-down menu ? edit your question to show the form code. – Kaperto Nov 10 '19 at 11:15

It is possible with the Smart Grid-layout Extension for CF7C plugin. The smart grid plugin has a [dynamic_dropdown] tag which allows you to filter the options.

dynamic dropdown tag creation screenshot

Replace your dropdown menu with a dynamic dropdown and in the tag Custom Source select the Custom tab, you can then populate the dropdown dynamically using,

add_filter('cf7sg_dynamic_dropdown_custom_options', 'filter_options',10,3);
function filter_options($options, $field_name, $form_key){
  if($form_key != 'my-form') return $options; //check this is the correct form.
  if($field_name != 'bookings') return $options; //check this is the correct field.
  $options = array();
  //load all your booking options.
  foreach($bookings as $booking){
    //verify if the booking limit is crossed.
    if($booking->count < $limit){
      $options[$booking->id] = $booking->title; //$options are $value=>$name pairs.
  return $options;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.