Home › Forums › Ticket Products › Event Tickets Plus › How prevent adding zero (0) tickets?
- This topic has 8 replies, 2 voices, and was last updated 10 years ago by
George.
-
AuthorPosts
-
March 29, 2016 at 7:28 am #1095360
Gabriel
ParticipantHello,
Is there a way to prvent click in ADD TO CART button if the total of tickets = 0?
ThanksMarch 29, 2016 at 10:58 am #1095541George
ParticipantHey 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!
GeorgeMarch 29, 2016 at 4:09 pm #1095672Gabriel
ParticipantHello,
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?
March 30, 2016 at 8:23 am #1095897George
ParticipantHi 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!
GeorgeMarch 30, 2016 at 10:54 am #1096037Gabriel
ParticipantIt 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?
ThanksMarch 30, 2016 at 10:55 am #1096038Gabriel
ParticipantAnd thankss!!!
March 31, 2016 at 6:03 am #1096335George
ParticipantHi 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,
GeorgeMarch 31, 2016 at 6:17 am #1096341Gabriel
ParticipantAh ok.. Perfect.. Thanks!!!
March 31, 2016 at 10:17 am #1096489George
Participant🙂
-
AuthorPosts
- The topic ‘How prevent adding zero (0) tickets?’ is closed to new replies.
