Remaining tickets

Home Forums Ticket Products Event Tickets Plus Remaining tickets

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1112046
    Marcus
    Participant

    Hi

    I have 2 kind of tickets on my site.
    Ticket 1 – 250 spots
    Ticket 2 – 50 spots

    I 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 Jansson

    #1112059
    George
    Participant

    Hey 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,
    George

    #1117841
    Support Droid
    Keymaster

    This 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.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Remaining tickets’ is closed to new replies.