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:
Mike Jolley 2015-03-10 10:24:01 +00:00
commit 6bf5262f67
2 changed files with 3 additions and 3 deletions

View File

@ -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' );

View File

@ -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 );
}
});