Tweak wc_get_product_variation_attributes to ignore non variation attributes

This commit is contained in:
Mike Jolley 2016-02-25 14:13:53 +00:00
parent d7d609d85a
commit 83d2f64e9e
1 changed files with 6 additions and 4 deletions

View File

@ -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
}
}
}