diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index 318c6b62818..065974e9811 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -488,7 +488,7 @@ class WC_Product { * @return bool */ public function is_taxable() { - $taxable = $this->tax_status == 'taxable' && wc_tax_enabled() ? true : false; + $taxable = $this->get_tax_status() === 'taxable' && wc_tax_enabled() ? true : false; return apply_filters( 'woocommerce_product_is_taxable', $taxable, $this ); } @@ -498,7 +498,7 @@ class WC_Product { * @return bool */ public function is_shipping_taxable() { - return $this->tax_status=='taxable' || $this->tax_status=='shipping' ? true : false; + return $this->get_tax_status() === 'taxable' || $this->get_tax_status() === 'shipping' ? true : false; } /** diff --git a/includes/class-wc-product-variation.php b/includes/class-wc-product-variation.php index ed31724712e..c33c1b371d6 100644 --- a/includes/class-wc-product-variation.php +++ b/includes/class-wc-product-variation.php @@ -409,6 +409,15 @@ class WC_Product_Variation extends WC_Product { return true === $this->managing_stock() ? wc_stock_amount( $this->stock ) : $this->parent->get_stock_quantity(); } + /** + * Returns the tax status. Always use parent data. + * + * @return string + */ + public function get_tax_status() { + return $this->parent->get_tax_status(); + } + /** * Returns whether or not the product is in stock. *