Merge pull request #7682 from franticpsyx/variations_min_max_quantity_js
[2.3] Fix: Handling of zero min/max input qty attributes in scripts
This commit is contained in:
commit
6bf5262f67
|
@ -433,12 +433,12 @@
|
|||
$variation_form.find( '.single_variation' ).html( '<p>' + wc_add_to_cart_variation_params.i18n_unavailable_text + '</p>' );
|
||||
}
|
||||
|
||||
if ( variation.min_qty )
|
||||
if ( variation.min_qty !== '' )
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).attr( 'min', variation.min_qty ).val( variation.min_qty );
|
||||
else
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).removeAttr( 'min' );
|
||||
|
||||
if ( variation.max_qty )
|
||||
if ( variation.max_qty !== '' )
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).attr( 'max', variation.max_qty );
|
||||
else
|
||||
$single_variation_wrap.find( '.quantity input.qty' ).removeAttr( 'max' );
|
||||
|
|
|
@ -9,7 +9,7 @@ jQuery( function( $ ) {
|
|||
$( 'input.qty:not(.product-quantity input.qty)' ).each( function() {
|
||||
var min = parseFloat( $( this ).attr( 'min' ) );
|
||||
|
||||
if ( min && min > 0 && parseFloat( $( this ).val() ) < min ) {
|
||||
if ( min >= 0 && parseFloat( $( this ).val() ) < min ) {
|
||||
$( this ).val( min );
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue