How Do I get ticket end time?

Home Forums Ticket Products Event Tickets Plus How Do I get ticket end time?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #963972
    designstudio
    Participant

    Hello,

    I’m trying to get the ticket end time so I can show a custom message when online ticket purchase time has ended but can buy it at the venue on the day of the event. Is there a function like “tribe_get_end_date” to do this?

    Thanks

    #964222
    Brian
    Keymaster

    Hi,

    Thanks for using our plugins. I can help out here.

    The ticket end time is saved in a custom field in the WooCommerce Product Custom Post Type the field is called:

    _ticket_end_date

    So calling this would get the value:

    get_post_meta( $ticket_id, '_ticket_end_date', true );

    Let me know if you have any follow up questions.

    Thanks

    #964600
    designstudio
    Participant

    Hello Brian,

    Thanks for the code. This actually is not working in my case and returns empty. Do they get setup through some hooks or loops other than the page loop? The previous developer customized the single-event template but removed a lot of the hooks and left only the page loop.

    #965070
    Brian
    Keymaster

    Hi,

    That function just looks for a meta entry based off the id so it does not really need a loop. It only needs an ID.

    My guess if it returns empty it is because the ticket_id variable does not have a value.

    You would have to use these functions to get the ticket id:


    $tickets = TribeEventsTickets::get_event_tickets( $event_id );

    foreach ( $tickets as $ticket ) {

    echo get_post_meta( $ticket->ID, '_ticket_end_date', true );

    }

    #973746
    Brian
    Keymaster

    Since I haven’t heard back from you here, I’m going to go ahead and close out this thread. Feel free to start a new thread if you have further issues. Thanks! 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How Do I get ticket end time?’ is closed to new replies.