WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Tax::calc_exclusive_tax() public WC 1.0

Calc tax from exclusive price.

Это метод класса: WC_Tax{}

Хуки из метода
Возвращает

Массив.

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

$result = WC_Tax::calc_exclusive_tax( $price, $rates );
$price(float) (обязательный)
Price to calculate tax for.
$rates(массив) (обязательный)
Array of tax rates.

Код WC_Tax::calc_exclusive_tax() WC 4.5.2

woocommerce/includes/class-wc-tax.php
<?php
public static function calc_exclusive_tax( $price, $rates ) {
	$taxes = array();

	if ( ! empty( $rates ) ) {
		foreach ( $rates as $key => $rate ) {
			if ( 'yes' === $rate['compound'] ) {
				continue;
			}

			$tax_amount = $price * ( $rate['rate'] / 100 );
			$tax_amount = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price ); // ADVANCED: Allow third parties to modify this rate.

			if ( ! isset( $taxes[ $key ] ) ) {
				$taxes[ $key ] = $tax_amount;
			} else {
				$taxes[ $key ] += $tax_amount;
			}
		}

		$pre_compound_total = array_sum( $taxes );

		// Compound taxes.
		foreach ( $rates as $key => $rate ) {
			if ( 'no' === $rate['compound'] ) {
				continue;
			}
			$the_price_inc_tax = $price + ( $pre_compound_total );
			$tax_amount        = $the_price_inc_tax * ( $rate['rate'] / 100 );
			$tax_amount        = apply_filters( 'woocommerce_price_ex_tax_amount', $tax_amount, $key, $rate, $price, $the_price_inc_tax, $pre_compound_total ); // ADVANCED: Allow third parties to modify this rate.

			if ( ! isset( $taxes[ $key ] ) ) {
				$taxes[ $key ] = $tax_amount;
			} else {
				$taxes[ $key ] += $tax_amount;
			}

			$pre_compound_total = array_sum( $taxes );
		}
	}

	/**
	 * Round all taxes to precision (4DP) before passing them back. Note, this is not the same rounding
	 * as in the cart calculation class which, depending on settings, will round to 2DP when calculating
	 * final totals. Also unlike that class, this rounds .5 up for all cases.
	 */
	$taxes = array_map( array( __CLASS__, 'round' ), $taxes );

	return $taxes;
}