Advertisement
eventsmanager

limit bookings to 1 ticket only

Jun 26th, 2015
1,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement