We’ve been using the following snippet for a long time, and it’s been working fine.
// Code to lookup and display remaining REQUIRED tickets
function my_print_tickets_left_after_selector($atts) {
global $wpdb;
$EVT_ID = get_the_ID();
//display a title
$x = '<h4>Remaining spaces: ';
$event = EEM_Event::instance()->get_one_by_ID($EVT_ID);
if( $event instanceof EE_Event ) {
$required_tickets = $event->tickets(
array(
array(
'TKT_required' => true
)
)
);
if($required_tickets) {
// Loop over all of the required tickets for the event.
foreach($required_tickets as $required_ticket) {
// Sanity check to make sure we have an EE_Ticket.
if($required_ticket instanceof EE_Ticket) {
// Add the spaces remaining for each required ticket to $spaces_remaining.
$remaining_spaces += $required_ticket->remaining();
}
}
}
}
Realised that the ticket hadn’t been marked as *REQUIRED*.
Viewing 1 reply thread
The support post ‘Shortcode – SHOW_REMAINING_TICKETS’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.