WC_Product_Variation::get_tax_class()publicWC 1.0

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

Return

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() code WC 8.7.0

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