WC_Tax::calc_tax()
Calculate tax for a line.
Метод класса: WC_Tax{}
Хуки из метода
Возвращает
Массив
. Array of rates + prices after tax.
Использование
$result = WC_Tax::calc_tax( $price, $rates, $price_includes_tax, $deprecated );
- $price(float) (обязательный)
- Price to calc tax on.
- $rates(массив) (обязательный)
- Rates to apply.
- $price_includes_tax(true|false)
- Whether the passed price has taxes included.
По умолчанию: false - $deprecated(true|false)
- Whether to suppress any rounding from taking place. No longer used here.
По умолчанию: false
Код WC_Tax::calc_tax() WC Tax::calc tax WC 9.5.1
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 ); }