How prevent adding zero (0) tickets?

Home Forums Ticket Products Event Tickets Plus How prevent adding zero (0) tickets?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1095360
    Gabriel
    Participant

    Hello,
    Is there a way to prvent click in ADD TO CART button if the total of tickets = 0?
    Thanks

    #1095541
    George
    Participant

    Hey Gabriel,

    By default, if the event is sold out, the “Add to Cart” button does get hidden and cannot be clicked.

    1. Do you not find this to be the case? If events are sold out, what do you find specifically?

    2. Can you link to an event on your site that has tickets for sale for it and is sold out, but the “Add to Cart” keeps showing?

    3. Finally, can you share your system information with us? Here’s how → https://theeventscalendar.com/knowledgebase/sharing-sys-info/

    Thank you!
    George

    #1095672
    Gabriel
    Participant

    Hello,

    Sorry.. I was no clear. I dont mean add tickets when they are sold out.
    I mean that if I have tickets, and I load the event, the box appears with a zero number.
    If I changed this number to 1 for example, the process continues normally.
    But If I just dont change the zero(0) and clic in Add to Cart button, the system send me to My Cart but its empty.
    I need that, if there are tickets available, the box has a zero in quantity and the user click in Add to Cart button, appears a message. Something like: “you need to add a quantity” or something like that.

    Cactch it?

    #1095897
    George
    Participant

    Hi Gabriel,

    Thank you for elaborating. While there is unfortunately no way for me to solve the issue of the “Add to Cart” option being clickable, what I CAN do here is recommend a solution so that the default ticket quantity is never 0. This will set the quantity in that box to 1, so that there is at least 1 ticket at all times.

    You can do this by adding this code to your theme’s functions.php file:


    add_action( 'wp_footer', 'tribe_994934_custom_js', 100 );

    function tribe_994934_custom_js() {
    ?>
    <script>
    jQuery(document).ready(function($){
    if ( $('.tribe-events-tickets').length ) {
    $('.tribe-events-tickets .quantity input.qty').val( '1' );
    }
    });
    </script>
    <?php
    }

    Cheers!
    George

    #1096037
    Gabriel
    Participant

    It worked perfect in an event with only 1 ticket.
    But in an event with 2 tickets, appears 1 in both tickets.
    How I define the DEFAULT ticket?
    Thanks

    #1096038
    Gabriel
    Participant

    And thankss!!!

    #1096335
    George
    Participant

    Hi Gabriel,

    I’m glad to have helped! For further refinement of this custom code, however, you will have to take things from here, because we cannot write custom code for folks (even though I was happy to just to get the main issues resolved).

    This, for example, is not possible at this time unless you write more custom code:

    But in an event with 2 tickets, appears 1 in both tickets. How I define the DEFAULT ticket?

    I am glad to have helped with the main issue here, and wish you the best of luck with your project.

    Sincerely,
    George

    #1096341
    Gabriel
    Participant

    Ah ok.. Perfect.. Thanks!!!

    #1096489
    George
    Participant

    🙂

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘How prevent adding zero (0) tickets?’ is closed to new replies.