Change template display, based on whether tickets are available

WordPress Event Management, Calendars & Registration Forums General Question Change template display, based on whether tickets are available

This topic contains 2 replies, has 2 voices, and was last updated by  Shaun Woods 6 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29265

    Hello,

    Is there any way to edit an event page template to display different information based on whether there are tickets for sale or not? (I couldn’t find this in the documentation – sorry).

    Many thanks,
    Shaun

    Shaun Woods
    #29269

    Hi Shaun,

    The eo-booking-form.php template (in event-organiser-pro/templates) does this:

     $occurrence_tickets = eo_get_the_occurrences_tickets( $booking_form->get( 'event_id' ) );
     ....
    
    } elseif ( ! $occurrence_tickets || ! eventorganiser_list_sum( $occurrence_tickets, 'available' ) ) {
      ...
    }
    

    More generally:

      $event_id = get_the_ID();
      $occurrence_tickets = eo_get_the_occurrences_tickets( $event_id );
      $sold_out =  ! $occurrence_tickets || ! eventorganiser_list_sum( $occurrence_tickets, 'available' );
    
      if ( $sold_out ) {
    
      }
    
    Stephen Harris
    #29270

    Hi Stephen,

    That second snippet did the trick perfectly!

    Thanks for helping out so quickly – it’s much appreciated πŸ™‚

    Shaun

    Shaun Woods
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.