Function that checks for available tickets?

Home Forums Calendar Products Community Events Function that checks for available tickets?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #864657
    goodwork
    Participant

    Hey guys! Is there a function that checks for available tickets and returns false if there are none (say registration has closed)? Something like what checks if the ticket form should be written or not? I am trying to make a Registration is Closed button on my event page, but I can’t find a function to check.

    Thanks!

    #864691
    Geoff
    Member

    Hi there, Matt! Thanks for getting in touch. ๐Ÿ™‚

    Great question. Yes, it sounds like you might be looking for theย tribe_has_tickets() function. This checks and determines if the current event has tickets. You can also check out our full documentation for all the ticketing functions available. If you type “ticket” in the search, it will auto-suggest relevant classes and functions.

    Does this help answer your question? Please let me know.

    Cheers!
    Geoff

    #865130
    goodwork
    Participant

    The problem with has_tickets was that it returned true even after the event. I ended up using $tickets = TribeEventsTickets::get_all_event_tickets($event_id); Then ran a for each on $tickets comparing the end date for each one with the current time (pulled from the tickets.php code) and that worked really well. Thanks for the help!

    #865505
    Geoff
    Member

    Awesome! I’m so glad that worked out and thanks for sharing your solution. That will definitely come in handy if someone else is in a similar situation.

    I’m going to go ahead and close this thread, but please feel free to hit us up with a new thread if any other questions pop up. We’d be happy to help. ๐Ÿ™‚

    Cheers!
    Geoff

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Function that checks for available tickets?’ is closed to new replies.