Skip to content

Instantly share code, notes, and snippets.

@jonathan-kosgei
Created August 15, 2017 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathan-kosgei/6ba463c071eb8d8677760a895f12f444 to your computer and use it in GitHub Desktop.
Save jonathan-kosgei/6ba463c071eb8d8677760a895f12f444 to your computer and use it in GitHub Desktop.
Woocommerce auto update cart on quantity change
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment