WC_Cart_Totals::calculate_fee_totals()
Triggers the cart fees API, grabs the list of fees, and calculates taxes.
Description Description
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.
Source Source
File: includes/class-wc-cart-totals.php
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' ) ) ) ); }
Changelog Changelog
Version | Description |
---|---|
3.2.0 | Introduced. |