Skip to content

Commit

Permalink
Simplify 'any-check' to only include empty string.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfabian committed Oct 2, 2019
1 parent 4cfe22e commit 3cbea2a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion includes/data-stores/class-wc-product-data-store-cpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 3cbea2a

Please sign in to comment.