WOOCOMMERCE TICKETS

Home Forums Ticket Products Event Tickets Plus WOOCOMMERCE TICKETS

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #992037
    Chris
    Participant

    We want to show on the events single page how many tickets have been sold and show how much tickets are in stock.

    Tried to use this code in the tribe-events/single-event.php:

    <span class=”show-sold-count”>
    <?php
    // DISPLAY SOLD X OUT OF Y
    global $post;
    echo get_post_meta($post->ID, ‘total_sales’, true);
    echo ‘ out of ‘;
    echo $product->get_stock_quantity();
    ?>
    </span>

    It didn’t work for us. What’s the best way to show it?

    • This topic was modified 8 years, 8 months ago by Chris.
    #992210
    George
    Participant

    Hey Chris,

    I wrote a function here that demonstrates how to do something like what you’re asking about → https://gist.github.com/ggwicz/31f9d9774e938846d635

    Add that to your theme’s functions.php file, and then instead of all the code you wrote above, try just replacing it with:

    <?php example_displaying_stock_information(); ?>

    Feel free, of course, to modify the function name and the markup to suit your needs.

    Let us know if this helps!

    Cheers,
    George

    #996283
    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 ‘WOOCOMMERCE TICKETS’ is closed to new replies.