Support

Home Forums Event Espresso Premium How to check if event sold out in loop

How to check if event sold out in loop

Posted: April 14, 2016 at 9:47 am


Biebob

April 14, 2016 at 9:47 am

Hi,

How can I check in template content-espresso_events-shortcode.php if an event is sold out or not? Is there a simple function for it?


Josh

  • Support Staff

April 14, 2016 at 3:16 pm

Hi there,

It turns out there’s an is_sold_out() method that you can use like this:

<?php
$event = EEH_Event_View::get_event();
if ( $event instanceof EE_Event ) {
	if ( $event->is_sold_out() || $event->is_sold_out( TRUE ) ) {
		echo '<h2>Sold out!</h2>';
	}
}
?>

The support post ‘How to check if event sold out in loop’ 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.

Event Espresso