Displaying tickets remaining instead of On sale!

Home Forums Ticket Products Event Tickets Plus Displaying tickets remaining instead of On sale!

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1015892
    Emiliano Pasini
    Participant

    Hi it would be possible instead of showing an “On sale!” on the monthly grid, to show the amount of tickets remaining for that day??

    I’m using the following script and is working fine. It would be great to improve this and add the remaining tickets instead,

    <?php if ( tribe_events_has_soldout() ): ?>
    <span class=”tickets-sold-out”>
    Sold out!
    </span>
    <?php elseif ( tribe_events_has_tickets() ): ?>
    <span class=”tickets-in-stock”>
    On sale!
    </span>
    <?php endif ?>

    Many thanks,
    Emiliano

    #1016026
    George
    Participant

    Hey Emiliano!

    It looks like you’re using WooCommerce Tickets, which is good news because we have a snippet that will make a new function available to you for showing the remaining ticket stock.

    Basically, you’ll first need to copy and paste the code in this Gist into your theme’s functions.php file → https://gist.github.com/ggwicz/e4d0d46cdf6d3977e5bc

    Then, where you currently have this:

    <span class=”tickets-in-stock”>
    On sale!
    </span>

    Replace it with this:


    <span class=”tickets-in-stock”>
    <?php echo example_displaying_stock_information(); ?>
    </span>

    You can of course change the function name to anything you’d like, and tweak the code however you’d like 🙂

    I hope this helps!

    Cheers,
    George

    #1016297
    Emiliano Pasini
    Participant

    Hi George, thank you for pointing me in the right direction.
    When I add this <span class=”tickets-in-stock”>
    <?php echo example_displaying_stock_information(); ?>
    </span> to single-event.php the calendar crash.

    I did paste the Gist script into functions.php

    Not sure what I’m doing wrong!

    #1016630
    George
    Participant

    I’m sorry to hear that @emiliano!

    Can you leave all of your custom code in place and then check to see if any errors pop up on your site if you head to your site’s wp-config.php file and change this line of code:

    define('WP_DEBUG', false);

    to this:

    define('WP_DEBUG', true);

    If errors display after doing this, let us know what you find!

    Thank you,
    George

    #1022115
    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 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Displaying tickets remaining instead of On sale!’ is closed to new replies.