WC_Cart_Totals::calculate_fee_totals()protectedWC 3.2.0

Triggers the cart fees API, grabs the list of fees, and calculates taxes.

Note: This class sets the totals for the 'object' as they are calculated. This is so that APIs like the fees API can see these totals if needed.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

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

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

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

Код WC_Cart_Totals::calculate_fee_totals() WC 8.7.0

protected function calculate_fee_totals() {
	$this->get_fees_from_cart();

	$this->set_total( 'fees_total', array_sum( wp_list_pluck( $this->fees, 'total' ) ) );
	$this->set_total( 'fees_total_tax', array_sum( wp_list_pluck( $this->fees, 'total_tax' ) ) );

	$this->cart->fees_api()->set_fees( wp_list_pluck( $this->fees, 'object' ) );
	$this->cart->set_fee_total( wc_remove_number_precision_deep( array_sum( wp_list_pluck( $this->fees, 'total' ) ) ) );
	$this->cart->set_fee_tax( wc_remove_number_precision_deep( array_sum( wp_list_pluck( $this->fees, 'total_tax' ) ) ) );
	$this->cart->set_fee_taxes( wc_remove_number_precision_deep( $this->combine_item_taxes( wp_list_pluck( $this->fees, 'taxes' ) ) ) );
}