Stock on event page

Home Forums Ticket Products Event Tickets Plus Stock on event page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #615468
    jimmy
    Participant

    Hi,

    I would like to show available stock on the event page for the ticket type available. Is this possible and if so how?
    Actually I would like to show both total stock and available tickets.
    Like “4 of 8 left” or something simular.

    #638753
    Barry
    Member

    Hi Jimmy,

    The first thing to do here is familiarize yourself with the process for overriding and customizing templates as described in our Themer’s Guide. From there, create a custom eddtickets/tickets.php template within your theme.

    The idea would be to add a little code, possibly right after this existing section:

    echo "<td class='tickets_description'>";
    echo $ticket->description;
    echo "</td>";

    Something like this ought to do the trick:

    $limit = get_post_meta( $product->ID, '_stock', true );
    $sold = edd_get_download_sales_stats( $product->ID );
    $remaining = $limit - $sold;
    
    echo "<td class='tickets_sales'>";
    echo "$remaining left! (sold $sold of $limit)";
    echo "</td>";

    Would that work for you here?

    #646065
    jimmy
    Participant

    Worked great, thanks!

    #650745
    Barry
    Member

    Awesome, glad that helped 🙂

    I’ll go ahead and close this thread in that case – but if we can help with anything else please don’t hesitate to create new threads and one of the team will be happy to help.

    Also, if you have a moment to spare, we’d love to hear your thoughts on The Events Calendar over on the plugin review page – thanks again!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Stock on event page’ is closed to new replies.