Answer the question
In order to leave comments, you need to log in
What is the reason for not updating the cart when clicking +-?
Good afternoon, tell me how to auto-update the basket when you press the + and - keys.
The problem is that if you enter a number into the input, then the basket will be updated, but if you click on + or -, then nothing happens?
https://promles.kiev.ua/cart/
Here is the script that I use to update the cart
add_action( 'wp_footer', 'cart_refresh_update_qty', 100 );
function cart_refresh_update_qty() {
if ( is_cart() ) {
?>
<script type="text/javascript">
jQuery('div.woocommerce').on('change', 'input.qty', function(){
setTimeout(function() {
jQuery('[name="update_cart"]').trigger('click');
}, 100 );
});
</script>
<?php
}
}
Answer the question
In order to leave comments, you need to log in
Judging by your code, the script will only work on the field change event
....
on('change', ...
.....
$(":input").bind('keyup mouseup', function () {
// Ваш код здесь
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question