wc_round_tax_total()WC 1.0

Round a tax amount.

Hooks from the function

Return

float.

Usage

wc_round_tax_total( $value, $precision );
$value(double) (required)
Amount to round.
$precision(int)
DP to round.
Default: wc_get_price_decimals

wc_round_tax_total() code WC 7.7.0

function wc_round_tax_total( $value, $precision = null ) {
	$precision = is_null( $precision ) ? wc_get_price_decimals() : intval( $precision );

	if ( version_compare( PHP_VERSION, '5.3.0', '>=' ) ) {
		$rounded_tax = NumberUtil::round( $value, $precision, wc_get_tax_rounding_mode() ); // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctionParameters.round_modeFound
	} elseif ( 2 === wc_get_tax_rounding_mode() ) {
		$rounded_tax = wc_legacy_round_half_down( $value, $precision );
	} else {
		$rounded_tax = NumberUtil::round( $value, $precision );
	}

	return apply_filters( 'wc_round_tax_total', $rounded_tax, $value, $precision, WC_TAX_ROUNDING_MODE );
}