get_tax_class should handle both parent data and unfiltered context to get the tax class before plugin modification.
This commit is contained in:
parent
f9dd3310b2
commit
01a4f9432f
|
@ -207,16 +207,25 @@ class WC_Product_Variation extends WC_Product_Simple {
|
||||||
/**
|
/**
|
||||||
* Returns the tax class.
|
* Returns the tax class.
|
||||||
*
|
*
|
||||||
* @param string $context
|
* Does not use get_prop so it can handle 'parent' Inheritance correctly.
|
||||||
|
*
|
||||||
|
* @param string $context view, edit, or unfiltered
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function get_tax_class( $context = 'view' ) {
|
public function get_tax_class( $context = 'view' ) {
|
||||||
$value = $this->get_prop( 'tax_class', $context );
|
$value = null;
|
||||||
|
|
||||||
// Inherit value from parent.
|
if ( array_key_exists( 'tax_class', $this->data ) ) {
|
||||||
if ( 'view' === $context && 'parent' === $value ) {
|
$value = array_key_exists( 'tax_class', $this->changes ) ? $this->changes['tax_class'] : $this->data['tax_class'];
|
||||||
|
|
||||||
|
if ( 'edit' !== $context && 'parent' === $value ) {
|
||||||
$value = $this->parent_data['tax_class'];
|
$value = $this->parent_data['tax_class'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( 'view' === $context ) {
|
||||||
|
$value = apply_filters( $this->get_hook_prefix() . 'tax_class', $value, $this );
|
||||||
|
}
|
||||||
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue