• Resolved jewelsmac6

    (@jewelsmac6)


    I am trying to post tickets for sale for three dates, with three choices available for each date for the customer to select the number of guests. Because we have only one slot, we can only take one party regardless of the number of people. So, once a purchase is made for each date, then that date becomes “booked” and will no longer be available (i.e. the other two choices cannot be purchased). In other words, a maximum of one ticket can be purchased for each date. How can I set this up? Thank you in advance!

    DATE 1
    Ticket Choice 1: four guests
    Ticket Choice 2: six guests
    Ticket Choice 3: eight guests

    DATE 2
    Ticket Choice 1: four guests
    Ticket Choice 2: six guests
    Ticket Choice 3: eight guests

    DATE 3
    Ticket Choice 1: four guests
    Ticket Choice 2: six guests
    Ticket Choice 3: eight guests

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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!

    Thread Starter jewelsmac6

    (@jewelsmac6)

    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

    Thread Starter jewelsmac6

    (@jewelsmac6)

    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!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Limit one ticket purchase per event’ is closed to new replies.