From 3cbea2a902603bffe3321687c2115c76467286b7 Mon Sep 17 00:00:00 2001 From: Peter Fabian Date: Wed, 2 Oct 2019 16:58:45 +0200 Subject: [PATCH] Simplify 'any-check' to only include empty string. --- includes/data-stores/class-wc-product-data-store-cpt.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/data-stores/class-wc-product-data-store-cpt.php b/includes/data-stores/class-wc-product-data-store-cpt.php index 328ea09c85886..e968a71578506 100644 --- a/includes/data-stores/class-wc-product-data-store-cpt.php +++ b/includes/data-stores/class-wc-product-data-store-cpt.php @@ -1112,7 +1112,7 @@ public function find_matching_product_variation( $product, $match_attributes = a // Loop over the variation meta keys and values i.e. what is saved to the products. Note: $attribute_value is empty when 'any' is in use. foreach ( $variation as $attribute_key => $attribute_value ) { - $match_any_value = empty( $attribute_value ) && 0.0 !== floatval( $attribute_value ); + $match_any_value = '' === $attribute_value; if ( ! $match_any_value && ! array_key_exists( $attribute_key, $match_attributes ) ) { $match = false; // Requires a selection but no value was provide.