-
-
Save Pebblo/65597083f820ddbb6184c0a3aa5fe61c to your computer and use it in GitHub Desktop.
Example of how to change the calendar available spaces to use the first ticket within an event if the ticket name contains 'Participant'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('FHEE__EE_Calendar__tooltip_datetime_available_spaces', 'tw_calendar_datetime_available_spaces', 10, 2 ); | |
function tw_calendar_datetime_available_spaces( $default_value, $datetime ) { | |
$query_params = array( | |
array( | |
'TKT_deleted' => false, | |
), | |
'order_by' => 'TKT_order', | |
'order' => 'ASC' | |
); | |
$first_ticket = $datetime->get_first_related('Ticket', $query_params ); | |
if( $first_ticket instanceof EE_Ticket && strpos($first_ticket->name(), 'Participant' ) !== false ) { | |
return $first_ticket->qty('saleable'); | |
} | |
return $default_value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment