Home Forums Event Espresso Premium Shortcode – SHOW_REMAINING_TICKETS


Posted: June 12, 2020 at 4:08 am


June 12, 2020 at 4:08 am

Hello again,

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(
'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();

$x .= $remaining_spaces;
$x .= '</h4>';
return $x;


From this thread

As you’ll see from this page, it’s now stopped working. The code still displays the text, but it’s not pulling the number of tickets.

In the event settings, limits are set for both the tickets and the datetimes, and there are still spaces remaining.

Any suggestions on how to fix?


June 12, 2020 at 4:11 am

Sorted it.

Realised that the ticket hadn’t been marked as *REQUIRED*.

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  dee4dogs 3 weeks, 6 days ago ago

Topic Tags


This topic is: resolved
Do NOT follow this link or you will be banned from the site!