WordPress at Your Fingertips
function is not described

WC_Cart_Totals::calculate_shipping_totals() protected WC 3.2.0

Calculate any shipping taxes.

{} It's a method of the class: WC_Cart_Totals{}

No Hooks.

Return

null. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->calculate_shipping_totals();

Changelog

Since 3.2.0 Introduced.

Code of WC_Cart_Totals::calculate_shipping_totals() WC 5.9.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' ) ) ) );
}