Conditional Statment for Event Tickets within loop

Home Forums Ticket Products Event Tickets Plus Conditional Statment for Event Tickets within loop

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #46701
    Joe
    Participant

    I’m trying to create a conditional statement to display a message if there are no tickets (WooTickets) connected to the event inside a custom events query loop.

    if (function_exists(‘tribe_get_ticket_form’) && tribe_get_ticket_form()) {
    tribe_get_ticket_form();
    } else {
    echo “Not For Sale Yet”;
    }

    I would like to show this message for when there is not yet a ticket created (or maybe there will never be an online ticket) for an event, however I can’t for the life of me get this to work. The code above outputs the else statement on all events, regardless if there is a ticket or not.

    Originally I thought I would mess with “$is_there_any_product” inside Tickets.PHP, however I’m pretty positive now that the tickets.PHP form doesn’t even load if there are no tickets.

    Could someone guide me with some insight on how I could get this to work?

    Thank you!

    #46745
    Jonah
    Participant

    Hi Joe,

    I’m going to move this to the WooTickets forum where Barry should be able to you help with this.

    #46761
    Barry
    Member

    Hi Joe, can you take a look at this thread?

    Basically you could build your own template tag (snippet is in that thread) to detect if an event has any tickets (WooTickets tickets that is, other ticket types won’t be detected) and go from there.

    The approach you outlined is actually viable with a few changes and a means of communicating between the two templates – you can see this as a strategy I outlined for a vaguely similar scenario over here.

    Let me know if you have further questions/need anything else.

    Thanks!

    #48168
    Barry
    Member

    Closing as there hasn’t been any further follow up on this one.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Conditional Statment for Event Tickets within loop’ is closed to new replies.