Merge pull request #13643 from woocommerce/fix-13639

Force max to blank string when < 0
This commit is contained in:
Mike Jolley 2017-03-17 15:36:35 +00:00 committed by GitHub
commit 2970a64516
1 changed files with 4 additions and 9 deletions

View File

@ -1053,16 +1053,11 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );
// Apply sanity to min/max args - min cannot be lower than 0.
if ( $args['min_value'] < 0 ) {
$args['min_value'] = 0;
}
$args['min_value'] = max( $args['min_value'], 0 );
$args['max_value'] = 0 < $args['max_value'] ? $args['max_value'] : '';
if ( '' === $args['max_value'] ) {
$args['max_value'] = -1;
}
// Max cannot be lower than 0 or min
if ( 0 < $args['max_value'] && $args['max_value'] < $args['min_value'] ) {
// Max cannot be lower than min if defined.
if ( '' !== $args['max_value'] && $args['max_value'] < $args['min_value'] ) {
$args['max_value'] = $args['min_value'];
}