/** | |
* Auto update cart after quantity change | |
* | |
* @return string | |
**/ | |
add_action( 'wp_footer', 'cart_update_qty_script' ); | |
function cart_update_qty_script() { | |
if (is_cart()) : | |
?> | |
<script> | |
jQuery('div.woocommerce').on('change', '.qty', function(){ | |
jQuery("[name='update_cart']").trigger("click"); | |
}); | |
</script> | |
<?php | |
endif; | |
} |
This comment has been minimized.
This comment has been minimized.
works perfectly, thanks |
This comment has been minimized.
This comment has been minimized.
Hi, With woocommerce 3.0.X, it works only for every second update. So if I change the quantity, it does not update. If I change it again, it does update. If I change it a third time, it does nothing and if I change it a forth time, is does update. If I dont use the dropdown code, it updates every time. Any idea how to fix this? Many thanks! |
This comment has been minimized.
This comment has been minimized.
In addition to my previous post: I have no skills in javascript at all, but tried some code and the following worked on desktop and on mobile, but I am sure that this is really bad coded :)
|
This comment has been minimized.
This comment has been minimized.
Hey @Anikora, I've had the same problem. I've slightly changed the original poster his code:
Hope this fix your problem. |
This comment has been minimized.
This comment has been minimized.
Hi there. If it helps anyone, to solve the 'it works every second time' issue I had to... Use a more specific selector: remove the 'disabled' attribute from the Update Cart button before applying the click trigger: |
This comment has been minimized.
Hi, not working