WC_Product_Variation::get_tax_class
Returns the tax class.
Does not use get_prop so it can handle 'parent' inheritance correctly.
Method of the class: WC_Product_Variation{}
Hooks from the method
Returns
String.
Usage
$WC_Product_Variation = new WC_Product_Variation(); $WC_Product_Variation->get_tax_class( $context );
- $context(string)
- view, edit, or unfiltered.
Default:'view'
WC_Product_Variation::get_tax_class() WC Product Variation::get tax class code WC 10.6.2
public function get_tax_class( $context = 'view' ) {
$value = null;
if ( array_key_exists( 'tax_class', $this->data ) ) {
$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'];
}
if ( 'view' === $context ) {
$value = apply_filters( $this->get_hook_prefix() . 'tax_class', $value, $this );
}
}
return $value;
}