Events available and price

Home Forums Ticket Products Event Tickets Plus Events available and price

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1162383
    Jon
    Participant

    Hi

    I am creating a shortcode to make a carousel that pulls through events by category and tags.
    Have been able to pull though the titles, dates and featured images without issues using tribe_get_events, wp_get_attachment_image_src and tribe_get_start_date .

    The only issue I can not find a solution for is that I want to be able to pull through the amounts of events spaces left and the price.
    Have been through plugin files and so on but can’t seem to figure that part out.

    Is there something like tribe_get_tickets_available and price?

    Cheers

    #1162751
    Jon
    Participant

    Have got the price pulling through now, Just can not find how to pull through the amount of places left in the event.
    Any ideas?

    Just so you can understand what I am doing. Have created a shortcode pulling through events by tag and only showing the next available event. Have then hooked Owl Carousel into the layout. In the image attached you can see the layout I have created, I am trying to pull though how many places are left to book on the event so I can place it above the JOIN CLASS button.

    Cheers

    #1162784
    Josh
    Participant

    Hey Jon,

    Thanks for reaching out to us!

    You should be able to get this using the object returned from the “get_tickets” method returned from the associated commerce class.

    For example, if you’re using WooCommerce, you could use something like:

    
    Tribe__Tickets_Plus__Commerce__WooCommerce__Main()->get_tickets( $post->ID );
    

    From there, you can get the stock remaining for each ticket by doing a foreach loop on that array and and using the “remaining()” method on each.

    
    foreach( $tickets as $ticket ) {
    $stock = $ticket->remaining();
    }
    

    Let me know if this helps.

    Thanks!

    #1162894
    Jon
    Participant

    Hey Josh

    Thanks for replying 🙂
    I could not get what you suggested to work how I wanted BUT did manage to pull through the number of tickets available with just using

    tribe_events_count_available_tickets( $event->ID )

    Cheers

    #1163483
    Josh
    Participant

    Hey Jon,

    Perfect! Glad you found that function! I didn’t see it when looking directly at how we’re outputting it in our templates.

    I’ll go ahead and close this thread for now. If you have any further questions, please don’t hesitate to open a new one.

    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Events available and price’ is closed to new replies.