wc_get_rounding_precision()WC 2.6.3

Get rounding precision for internal WC calculations. Will return the value of wc_get_price_decimals increased by 2 decimals, with WC_ROUNDING_PRECISION being the minimum.

Хуки из функции

Возвращает

int.

Использование

wc_get_rounding_precision();

Список изменений

С версии 2.6.3 Введена.

Код wc_get_rounding_precision() WC 8.9.0

function wc_get_rounding_precision() {
	$precision = wc_get_price_decimals() + 2;
	if ( $precision < absint( WC_ROUNDING_PRECISION ) ) {
		$precision = absint( WC_ROUNDING_PRECISION );
	}

	/**
	 * Filter the rounding precision for internal WC calculations. This is different from the number of decimals used for display.
	 * Generally, this filter can be used to decrease the precision, but if you choose to decrease, there maybe side effects such as off by one rounding errors for certain tax rate combinations.
	 *
	 * @since 8.8.0
	 *
	 * @param int $precision The number of decimals to round to.
	 */
	return apply_filters( 'woocommerce_internal_rounding_precision', $precision );
}