woocommerce auto update cart

var timeout;
jQuery( function( $ ) {
 $('.woocommerce').on('change', 'input.qty', function(){
 if ( timeout !== undefined ) {
 clearTimeout( timeout );
 }
 timeout = setTimeout(function() {
 $("[name='update_cart']").trigger("click");
 }, 1000 ); 
 });
} );