Skip to content

Commit

Permalink
check qty inputs after cart fragments refresh fixes #34
Browse files Browse the repository at this point in the history
  • Loading branch information
timelsass committed May 10, 2019
1 parent 04fb7c8 commit a546887
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/assets/js/woocommerce/quantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jQuery( document ).ready( function( $ ) {

$( '.input-number' ).focusin( function() {
$( this ).data( 'oldValue', $( this ).val() );
});
} );

$( '.input-number' ).change( function() {
var valueCurrent, minValue, maxValue, changed;
Expand Down Expand Up @@ -101,7 +101,7 @@ jQuery( document ).ready( function( $ ) {
if ( ( e.shiftKey || ( e.keyCode < 48 || e.keyCode > 57 ) ) && ( e.keyCode < 96 || e.keyCode > 105 ) ) {
e.preventDefault();
}
});
} );
};

qtyInput();
Expand All @@ -112,5 +112,8 @@ jQuery( document ).ready( function( $ ) {
$( '.woocommerce-cart .actions' ).wrapInner( '<div class="bgtfw-table-vertical-align"></div>' );

/* Trigger when cart updates run. */
$( 'body' ).on( 'updated_wc_div', qtyInput );
});
$( 'body' ).on( 'updated_wc_div wc_fragments_refreshed', function() {
qtyInput();
$( '.input-number' ).trigger( 'change' );
} );
} );

0 comments on commit a546887

Please sign in to comment.