WC_Cart_Totals::calculate_shipping_totals()protectedWC 3.2.0

Calculate any shipping taxes.

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

Хуков нет.

Возвращает

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

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

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

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

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

Код WC_Cart_Totals::calculate_shipping_totals() WC 8.7.0

protected function calculate_shipping_totals() {
	$this->get_shipping_from_cart();
	$this->set_total( 'shipping_total', array_sum( wp_list_pluck( $this->shipping, 'total' ) ) );
	$this->set_total( 'shipping_tax_total', array_sum( wp_list_pluck( $this->shipping, 'total_tax' ) ) );

	$this->cart->set_shipping_total( $this->get_total( 'shipping_total' ) );
	$this->cart->set_shipping_tax( $this->get_total( 'shipping_tax_total' ) );
	$this->cart->set_shipping_taxes( wc_remove_number_precision_deep( $this->combine_item_taxes( wp_list_pluck( $this->shipping, 'taxes' ) ) ) );
}