Skip to content

Instantly share code, notes, and snippets.

@Pebblo Pebblo/example.php Secret
Created Mar 1, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.