WC_Cart::get_cart_subtotal
Gets the sub total (after calculation).
Метод класса: WC_Cart{}
Хуки из метода
Возвращает
Строку. formatted price
Использование
$WC_Cart = new WC_Cart(); $WC_Cart->get_cart_subtotal( $compound );
- $compound(true|false)
- whether to include compound taxes.
По умолчанию:false
Код WC_Cart::get_cart_subtotal() WC Cart::get cart subtotal WC 10.5.0
public function get_cart_subtotal( $compound = false ) {
/**
* If the cart has compound tax, we want to show the subtotal as cart + shipping + non-compound taxes (after discount).
*/
if ( $compound ) {
$cart_subtotal = wc_price( $this->get_cart_contents_total() + $this->get_shipping_total() + $this->get_taxes_total( false, false ) );
} elseif ( $this->display_prices_including_tax() ) {
$cart_subtotal = wc_price( $this->get_subtotal() + $this->get_subtotal_tax() );
if ( $this->get_subtotal_tax() > 0 && ! wc_prices_include_tax() ) {
$cart_subtotal .= ' <small class="tax_label">' . WC()->countries->inc_tax_or_vat() . '</small>';
}
} else {
$cart_subtotal = wc_price( $this->get_subtotal() );
if ( $this->get_subtotal_tax() > 0 && wc_prices_include_tax() ) {
$cart_subtotal .= ' <small class="tax_label">' . WC()->countries->ex_tax_or_vat() . '</small>';
}
}
return apply_filters( 'woocommerce_cart_subtotal', $cart_subtotal, $compound, $this );
}