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

WC_Cart_Totals::calculate_totals() protected WC 3.2.0

Main cart totals.

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

Возвращает

null. Ничего.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->calculate_totals();

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

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

Код WC_Cart_Totals::calculate_totals() WC 5.4.1

<?php
protected function calculate_totals() {
	$this->set_total( 'total', NumberUtil::round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ), 0 ) );
	$items_tax = array_sum( $this->get_merged_taxes( false, array( 'items' ) ) );
	// Shipping and fee taxes are rounded seperately because they were entered excluding taxes (as opposed to item prices, which may or may not be including taxes depending upon settings).
	$shipping_and_fee_taxes = NumberUtil::round( array_sum( $this->get_merged_taxes( false, array( 'fees', 'shipping' ) ) ), wc_get_price_decimals() );
	$this->cart->set_total_tax( $items_tax + $shipping_and_fee_taxes );

	// Allow plugins to hook and alter totals before final total is calculated.
	if ( has_action( 'woocommerce_calculate_totals' ) ) {
		do_action( 'woocommerce_calculate_totals', $this->cart );
	}

	// Allow plugins to filter the grand total, and sum the cart totals in case of modifications.
	$this->cart->set_total( max( 0, apply_filters( 'woocommerce_calculated_total', $this->get_total( 'total' ), $this->cart ) ) );
}