WC_Abstract_Order::get_item_tax( mixed $item, bool $round = true )

Get item tax – useful for gateways.


Description Description


Parameters Parameters

$item

(Required) Item to get total from.

$round

(Optional) (default: true).

Default value: true


Top ↑

Return Return

(float)


Top ↑

Source Source

File: includes/abstracts/abstract-wc-order.php

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


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.