WC_Cart_Totals::calculate_shipping_totals()
Calculate any shipping taxes.
Method of the class: WC_Cart_Totals{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->calculate_shipping_totals();
Changelog
Since 3.2.0 | Introduced. |
WC_Cart_Totals::calculate_shipping_totals() WC Cart Totals::calculate shipping totals code WC 9.5.1
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' ) ) ) ); }