Automattic\WooCommerce\Blocks\BlockTypes

MiniCart::get_tax_label()protectedWC 1.0

Get array with data for handle the tax label. the entire logic of this function is was taken from: https://github.com/woocommerce/woocommerce/blob/e730f7463c25b50258e97bf56e31e9d7d3bc7ae7/includes/class-wc-cart.php#L1582

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

Хуков нет.

Возвращает

Массив;.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_tax_label();

Код MiniCart::get_tax_label() WC 7.1.0

protected function get_tax_label() {
	$cart = WC()->cart;

	if ( $cart->display_prices_including_tax() ) {
		if ( ! wc_prices_include_tax() ) {
			$tax_label                         = WC()->countries->inc_tax_or_vat();
			$display_cart_prices_including_tax = true;
			return array(
				'tax_label'                         => $tax_label,
				'display_cart_prices_including_tax' => $display_cart_prices_including_tax,
			);
		}
		return array(
			'tax_label'                         => '',
			'display_cart_prices_including_tax' => true,
		);
	}

	if ( wc_prices_include_tax() ) {
		$tax_label = WC()->countries->ex_tax_or_vat();
		return array(
			'tax_label'                         => $tax_label,
			'display_cart_prices_including_tax' => false,
		);
	};

	return array(
		'tax_label'                         => '',
		'display_cart_prices_including_tax' => false,
	);
}