From e7397f96e721de2c1fab95930ead8558c6ba85d1 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 17 Mar 2017 12:57:18 +0000 Subject: [PATCH] Force max to blank string when < 0 Fixes #13639 --- includes/wc-template-functions.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index 0bfc3301d88..5cac73724de 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -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']; }