Set min and max value to empty string if not set

This commit is contained in:
Fredrik Forsmo 2016-06-29 13:13:11 +02:00
parent 01a2acabdc
commit 755ede10a3
1 changed files with 4 additions and 0 deletions

View File

@ -1028,6 +1028,10 @@ if ( ! function_exists( 'woocommerce_quantity_input' ) ) {
$args = apply_filters( 'woocommerce_quantity_input_args', wp_parse_args( $args, $defaults ), $product );
// Set min and max value to empty string if not set.
$args['min_value'] = isset( $args['min_value'] ) ? $args['min_value'] : '';
$args['max_value'] = isset( $args['max_value'] ) ? $args['max_value'] : '';
// Apply sanity to min/max args - min cannot be lower than 0
if ( '' !== $args['min_value'] && is_numeric( $args['min_value'] ) && $args['min_value'] < 0 ) {
$args['min_value'] = 0; // Cannot be lower than 0