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.

Метод класса: WC_Product_Variation{}

Хуки из метода

Возвращает

Строку.

Использование

$WC_Product_Variation = new WC_Product_Variation();
$WC_Product_Variation->get_tax_class( $context );
$context(строка)
view, edit, or unfiltered.
По умолчанию: 'view'

Код WC_Product_Variation::get_tax_class() 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;
}