WordPress at Your Fingertips
function is not described

WC_Tax::calc_tax() public WC 1.0

Calculate tax for a line.

{} It's a method of the class: WC_Tax{}

Hooks from the method

Return

Array. Array of rates + prices after tax.

Usage

$result = WC_Tax::calc_tax( $price, $rates, $price_includes_tax, $deprecated );
$price(float) (required)
Price to calc tax on.
$rates(array) (required)
Rates to apply.
$price_includes_tax(true|false)
Whether the passed price has taxes included.
Default: false
$deprecated(true|false)
Whether to suppress any rounding from taking place. No longer used here.
Default: false

Code of WC_Tax::calc_tax() WC 5.9.0

public static function calc_tax( $price, $rates, $price_includes_tax = false, $deprecated = false ) {
	if ( $price_includes_tax ) {
		$taxes = self::calc_inclusive_tax( $price, $rates );
	} else {
		$taxes = self::calc_exclusive_tax( $price, $rates );
	}
	return apply_filters( 'woocommerce_calc_tax', $taxes, $price, $rates, $price_includes_tax, $deprecated );
}