Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Created March 1, 2019 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/65597083f820ddbb6184c0a3aa5fe61c to your computer and use it in GitHub Desktop.
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'
<?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