Home › Forums › Ticket Products › Event Tickets Plus › Remaining tickets
- This topic has 2 replies, 3 voices, and was last updated 9 years, 11 months ago by
Support Droid.
-
AuthorPosts
-
May 8, 2016 at 1:45 pm #1112046
Marcus
ParticipantHi
I have 2 kind of tickets on my site.
Ticket 1 – 250 spots
Ticket 2 – 50 spotsI would like to have on my startpage in a widget (or in page content) a function that will show something like this:
Totalt remaining spots left: 300
It will take the totalt amount of remaining tickets from “Ticket 1” plus the “Ticket 2” and get updated as soon as someone makes a booking.
Do you got any code for this? I´ve tried but not manage to fix it, I realy wan´t this function.
Best Regards
Marcus JanssonMay 8, 2016 at 3:58 pm #1112059George
ParticipantHey Marcus,
Thanks for reaching out.
We unfortunately do not have code that would do this for you—you would have to write some custom code yourself that first pulls in the appropriate event, and then extracts the stock information from the event.
You can go about retrieving the events with a function called tribe_get_events(), which you can read about here ? https://theeventscalendar.com/knowledgebase/using-tribe_get_events/
To get stock from the events you retrieve in this way, you will have to do some tinkering, but I can at least help you get started with how to get the tickets themselves to begin with. You can do that with code like this:
$woo_tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();foreach ( $woo_tickets->get_tickets( $event_id ) as $ticket ) {
// Do stuff with the $ticket, like find its stock and echo it, etc.
}
⚠️ We cannot help with custom coding, so you will have to take the reins from here. Please read this page for more information. If you need further assistance writing custom code, I would recommend hiring a professional developer to assist you. We have a list of great developers here → http://m.tri.be/18k1 (and we have no affiliation with any of these folks–they’re simply some well-respected names in the community that we’ve compiled).
I’ve shared information here to get started with the customizing and hope it helps.
Best of luck with your project,
GeorgeMay 23, 2016 at 9:35 am #1117841Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Remaining tickets’ is closed to new replies.
