wc_round_tax_total() WC 1.0
Round a tax amount.
Хуки из функции
Возвращает
float.
Использование
wc_round_tax_total( $value, $precision );
- $value(double) (обязательный)
- Amount to round.
- $precision(число)
- DP to round.
По умолчанию: wc_get_price_decimals
Код wc_round_tax_total() wc round tax total WC 5.0.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 );
}