WC_Cart::get_taxes_total()publicWC 1.0

Get tax row amounts with or without compound taxes includes.

Метод класса: WC_Cart{}

Хуки из метода

Возвращает

float. price

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

$WC_Cart = new WC_Cart();
$WC_Cart->get_taxes_total( $compound, $display );
$compound(true|false)
True if getting compound taxes.
По умолчанию: true
$display(true|false)
True if getting total to display.
По умолчанию: true

Код WC_Cart::get_taxes_total() WC 8.7.0

public function get_taxes_total( $compound = true, $display = true ) {
	$total = 0;
	$taxes = $this->get_taxes();
	foreach ( $taxes as $key => $tax ) {
		if ( ! $compound && WC_Tax::is_compound( $key ) ) {
			continue;
		}
		$total += $tax;
	}
	if ( $display ) {
		$total = wc_format_decimal( $total, wc_get_price_decimals() );
	}
	return apply_filters( 'woocommerce_cart_taxes_total', $total, $compound, $display, $this );
}