Skip to content

Commit

Permalink
Tweak wc_get_product_variation_attributes to ignore non variation att…
Browse files Browse the repository at this point in the history
…ributes
  • Loading branch information
mikejolley committed Feb 25, 2016
1 parent d7d609d commit 83d2f64
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/wc-product-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,12 @@ function wc_get_product_variation_attributes( $variation_id ) {

// Compare to parent variable product attributes and ensure they match
foreach ( $parent_attributes as $attribute_name => $options ) {
$attribute = 'attribute_' . sanitize_title( $attribute_name );
$found_parent_attributes[] = $attribute;
if ( ! empty( $options['is_variation'] ) && ! array_key_exists( $attribute, $variation_attributes ) ) {
$variation_attributes[ $attribute ] = ''; // Add it - 'any' will be asumed
if ( ! empty( $options['is_variation'] ) ) {
$attribute = 'attribute_' . sanitize_title( $attribute_name );
$found_parent_attributes[] = $attribute;
if ( ! array_key_exists( $attribute, $variation_attributes ) ) {
$variation_attributes[ $attribute ] = ''; // Add it - 'any' will be asumed
}
}
}

Expand Down

0 comments on commit 83d2f64

Please sign in to comment.