Home › Forums › Ticket Products › Event Tickets Plus › Events available and price
- This topic has 5 replies, 3 voices, and was last updated 9 years, 7 months ago by
Josh.
-
AuthorPosts
-
September 10, 2016 at 6:27 am #1162383
Jon
ParticipantHi
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
September 12, 2016 at 6:22 am #1162751Jon
ParticipantHave 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
September 12, 2016 at 7:40 am #1162784Josh
ParticipantHey 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!
September 12, 2016 at 10:42 am #1162894Jon
ParticipantHey 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 usingtribe_events_count_available_tickets( $event->ID )
Cheers
September 13, 2016 at 9:36 am #1163483Josh
ParticipantHey 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!
-
AuthorPosts
- The topic ‘Events available and price’ is closed to new replies.
