You can use this snippet to set the maximum number of tickets that can be purchased at once:
PLEASE NOTE THIS DOES NOT WORK WITH WOOCOMMERCE
/* Tribe, limit ticket qty */
function tribe_limit_tickets() {
?>
<script type=”text/javascript”>
jQuery(document).ready( function( $ ) {
// do this if tickets available
if ( $(‘.tribe-events-tickets’).length ) {
// set max qty to 1
$(‘.tribe-events-tickets .tribe-ticket-quantity’).attr(‘max’, 2);
// run on input change
$(‘.tribe-events-tickets .tribe-ticket-quantity’).change ( function ( ) {
// don’t run the manually triggered change event
if ( $(this).val() == 0 ) return;
// make sure it’s not more than 1
if ( $(this).val() > 2 ) $(this).val(2);
// change all inputs but this to 0
// manually trigger the change event so available stock gets updated
$(‘.tribe-events-tickets .tribe-ticket-quantity’).not( $(this) ).val(0).change();
});
// add a oninput event
$(‘.tribe-events-tickets .tribe-ticket-quantity’).on(‘input’, function (e) {
$(this).change();
});
}
});
</script>
<?php
}
add_action(‘wp_head’, ‘tribe_limit_tickets’);
Let me know if this works for you!
OK, I will add this to the functions.php file and test.
So you can see a visual, this error is appearing: https://snipboard.io/IchKDs.jpg
Warning: Use of undefined constant ‘wp_head’ – assumed ‘‘wp_head’’ (this will throw an Error in a future version of PHP) in /home/customer/www/seasonalpantry.com/public_html/wp-content/themes/astra-child/functions.php on line 58
Warning: Use of undefined constant ‘tribe_limit_tickets’ – assumed ‘‘tribe_limit_tickets’’ (this will throw an Error in a future version of PHP) in /home/customer/www/seasonalpantry.com/public_html/wp-content/themes/astra-child/functions.php on line 58
I corrected all of the quotation marks and the error went away.
I purchased the third option, but the other two are still available for purchase. I was hoping that the other two would become unavailable, no further sales for this date. In other words, once one option is purchased, then all other options become unavailable.
Screenshot: https://snipboard.io/Q17DTc.jpg
I appreciate your help!
Hi
@jewelsmac6 Thank you for that clarification. This is not really possible without significant customisation. You may want to hire a developer to help get that done. You could also submit this feature in our Ideas board here:
https://app.productstash.io/the-events-calendar-suite-roadmap#ideas
Hey @saz25
Looks like we haven’t heard from you in a bit so I am going to mark this as resolved. Please reach back out if you need more help!