WC_Tax::calc_tax()public staticWC 1.0

Calculate tax for a line.

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

WC_Tax::calc_tax() code WC 8.7.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 );
}