SHARE
TWEET

limit bookings to 1 ticket only

eventsmanager Jun 26th, 2015 (edited) 460 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * if ( $EM_Booking->booking_spaces > 2){ echo "Max of 2 ticket spacess is allowed"; }
  3.  */
  4. function my_em_booking_ticket($result,$EM_Booking){
  5.    
  6.   $ticket_count = 0;
  7.  
  8.   foreach($EM_Booking->tickets_bookings as $EM_Ticket_Booking){
  9.     $ticket_count++;
  10.   }
  11.  
  12.   if ( $ticket_count > 1 ){
  13.     $EM_Booking->add_error('Only one ticket is allowed per booking');
  14.     $result = false;
  15.   }
  16.    
  17.   return $result;
  18. }
  19. add_filter('em_booking_validate','my_em_booking_ticket',100,2);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top