Hey there,
I searched the forums and was unable to find a solution for my problem.
I would like to make it so that when on the event page when a customer adds a ticket to the cart, it’s added but they remain on the event page.
When I use the following code, the tickets are not added to the cart. I’m just hoping someone can point out whether or not there’s something special that needs to be done specifically for WooCommerce in order for this to work.
I’m not sure why the data is not being passed along.
<script type="text/javascript">
$(function() {
$('form.ticket-checkout').submit(function(event) {
event.preventDefault(); // Prevent the form from submitting via the browser
var form = $(this);
$.ajax({
type: form.attr('method'),
url: form.attr('action'),
data: form.serialize()
}).done(function(data) {
// Optionally alert the user of success here...
alert('ok');
}).fail(function(data) {
// Optionally alert the user of an error here...
});
});
});
</script>