Home › Forums › Ticket Products › Event Tickets Plus › Displaying tickets remaining instead of On sale!
- This topic has 4 replies, 3 voices, and was last updated 10 years, 5 months ago by
Support Droid.
-
AuthorPosts
-
October 19, 2015 at 9:38 am #1015892
Emiliano Pasini
ParticipantHi 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,
EmilianoOctober 19, 2015 at 4:44 pm #1016026George
ParticipantHey 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,
GeorgeOctober 20, 2015 at 10:30 am #1016297Emiliano Pasini
ParticipantHi 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!
October 21, 2015 at 10:06 am #1016630George
ParticipantI’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,
GeorgeNovember 5, 2015 at 6:05 am #1022115Support 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 ‘Displaying tickets remaining instead of On sale!’ is closed to new replies.
