Created
November 10, 2016 13:35
-
-
Save palicko/0ff7fbe4a19f9bb4483340c1b7708d2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Auto update cart after quantity change | |
* | |
* @return string | |
**/ | |
add_action( 'wp_footer', 'cart_auto_update_qty_script' ); | |
function cart_auto_update_qty_script() { | |
if ( is_cart() ) : ?> | |
<script> | |
jQuery('div.woocommerce').on('change', '.qty', function(){ | |
jQuery("[name='update_cart']").trigger("click"); | |
}); | |
</script> | |
<?php endif; | |
} | |
// hide with CSS | |
.woocommerce-cart [name="update_cart"] { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment