WC_Abstract_Order::get_item_tax()publicWC 1.0

Get item tax - useful for gateways.

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

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

Возвращает

float.

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

$WC_Abstract_Order = new WC_Abstract_Order();
$WC_Abstract_Order->get_item_tax( $item, $round );
$item(разное) (обязательный)
Item to get total from.
$round(true|false)
-
По умолчанию: true)

Код WC_Abstract_Order::get_item_tax() WC 8.7.0

public function get_item_tax( $item, $round = true ) {
	$tax = 0;

	if ( is_callable( array( $item, 'get_total_tax' ) ) && $item->get_quantity() ) {
		$tax = $item->get_total_tax() / $item->get_quantity();
		$tax = $round ? wc_round_tax_total( $tax ) : $tax;
	}

	return apply_filters( 'woocommerce_order_amount_item_tax', $tax, $item, $round, $this );
}