Make sure filters apply on parent_data

Closes #14321
This commit is contained in:
Mike Jolley 2017-04-13 12:48:21 +01:00
parent 01a4f9432f
commit 8268fc01ad
1 changed files with 9 additions and 9 deletions

View File

@ -135,7 +135,7 @@ class WC_Product_Variation extends WC_Product_Simple {
// Inherit value from parent.
if ( 'view' === $context && empty( $value ) ) {
$value = $this->parent_data['sku'];
$value = apply_filters( $this->get_hook_prefix() . 'sku', $this->parent_data['sku'], $this );
}
return $value;
}
@ -151,7 +151,7 @@ class WC_Product_Variation extends WC_Product_Simple {
// Inherit value from parent.
if ( 'view' === $context && empty( $value ) ) {
$value = $this->parent_data['weight'];
$value = apply_filters( $this->get_hook_prefix() . 'weight', $this->parent_data['weight'], $this );
}
return $value;
}
@ -167,7 +167,7 @@ class WC_Product_Variation extends WC_Product_Simple {
// Inherit value from parent.
if ( 'view' === $context && empty( $value ) ) {
$value = $this->parent_data['length'];
$value = apply_filters( $this->get_hook_prefix() . 'length', $this->parent_data['length'], $this );
}
return $value;
}
@ -183,7 +183,7 @@ class WC_Product_Variation extends WC_Product_Simple {
// Inherit value from parent.
if ( 'view' === $context && empty( $value ) ) {
$value = $this->parent_data['width'];
$value = apply_filters( $this->get_hook_prefix() . 'width', $this->parent_data['width'], $this );
}
return $value;
}
@ -199,7 +199,7 @@ class WC_Product_Variation extends WC_Product_Simple {
// Inherit value from parent.
if ( 'view' === $context && empty( $value ) ) {
$value = $this->parent_data['height'];
$value = apply_filters( $this->get_hook_prefix() . 'height', $this->parent_data['height'], $this );
}
return $value;
}
@ -257,7 +257,7 @@ class WC_Product_Variation extends WC_Product_Simple {
// Inherit value from parent.
if ( 'view' === $context && 'parent' === $this->get_manage_stock() ) {
$value = $this->parent_data['stock_quantity'];
$value = apply_filters( $this->get_hook_prefix() . 'stock_quantity', $this->parent_data['stock_quantity'], $this );
}
return $value;
}
@ -274,7 +274,7 @@ class WC_Product_Variation extends WC_Product_Simple {
// Inherit value from parent.
if ( 'view' === $context && 'parent' === $this->get_manage_stock() ) {
$value = $this->parent_data['backorders'];
$value = apply_filters( $this->get_hook_prefix() . 'backorders', $this->parent_data['backorders'], $this );
}
return $value;
}
@ -290,7 +290,7 @@ class WC_Product_Variation extends WC_Product_Simple {
$image_id = $this->get_prop( 'image_id', $context );
if ( 'view' === $context && ! $image_id ) {
$image_id = $this->parent_data['image_id'];
$value = apply_filters( $this->get_hook_prefix() . 'image_id', $this->parent_data['image_id'], $this );
}
return $image_id;
@ -307,7 +307,7 @@ class WC_Product_Variation extends WC_Product_Simple {
$shipping_class_id = $this->get_prop( 'shipping_class_id', $context );
if ( 'view' === $context && ! $shipping_class_id ) {
$shipping_class_id = $this->parent_data['shipping_class_id'];
$value = apply_filters( $this->get_hook_prefix() . 'shipping_class_id', $this->parent_data['shipping_class_id'], $this );
}
return $shipping_class_id;