Hi there!
On our site we are currently selling tickets by date, so in our case an event might occur every Monday, Wednesday and Friday at 3 p.m., for the next xx months, and people buy tickets for one of those events.
The problem we are encountering is that people can book an event just a few minutes before it begins, making it almost impossible for us to react in time, which isn’t a problem if it is an event which occurs only once, since it is possible to define until when tickets are being sold.
So my question is whether it is possible to close the booking of an event, such as the one I described, a few hours before each occurrence begins. (e.g. Wednesday at 2 p.m. no one should be able to buy a ticket for the event that starts an hour later, however the one on Friday at the same time should still be bookable.)
Thanks in advance!
-
This topic was modified 9 years, 11 months ago by
André Vasanne.

André Vasanne
Hi André
Since 1.8 you can do the following to exclude occurrences within the next hour from the array of bookable occurrences:
add_filter( 'eventorganiser_bookable_occurrences', 'my_set_bookable_occurrences', 10, 2 );
function my_set_bookable_occurrences( $bookable_occurrences, $event_id ){
$one_hours_time = new DateTime( '+1 hour', eo_get_blog_timezone() );
if( $bookable_occurrences ){
foreach( $bookable_occurrences as $key => $occurrence ){
if( $occurrence['start'] < $one_hours_time ){
unset( $bookable_occurrences[$key] );
}
}
}
return $bookable_occurrences;
}

Stephen Harris
Thank you for your help! However I don’t know where to add these lines of code, so your help would be much appreciated!

André Vasanne
Thank you very much, works perfectly!

André Vasanne