Move cart totals setter for 3.1 compat

Closes #16794
This commit is contained in:
Mike Jolley 2017-09-15 11:15:50 -07:00
parent 83f60c68ab
commit d3da954133
1 changed files with 4 additions and 3 deletions

View File

@ -616,6 +616,10 @@ final class WC_Cart_Totals {
$this->set_total( 'items_total', array_sum( array_values( wp_list_pluck( $this->items, 'total' ) ) ) );
$this->set_total( 'items_total_tax', array_sum( array_values( wp_list_pluck( $this->items, 'total_tax' ) ) ) );
$this->cart->set_cart_contents_total( $this->get_total( 'items_total' ) );
$this->cart->set_cart_contents_tax( array_sum( $this->get_merged_taxes( false, 'items' ) ) );
$this->cart->set_cart_contents_taxes( $this->get_merged_taxes( false, 'items' ) );
}
/**
@ -755,9 +759,6 @@ final class WC_Cart_Totals {
$this->set_total( 'total', round( $this->get_total( 'items_total', true ) + $this->get_total( 'fees_total', true ) + $this->get_total( 'shipping_total', true ) + array_sum( $this->get_merged_taxes( true ) ) ) );
// Add totals to cart object.
$this->cart->set_cart_contents_total( $this->get_total( 'items_total' ) );
$this->cart->set_cart_contents_tax( array_sum( $this->get_merged_taxes( false, 'items' ) ) );
$this->cart->set_cart_contents_taxes( $this->get_merged_taxes( false, 'items' ) );
$this->cart->set_discount_total( $this->get_total( 'discounts_total' ) );
$this->cart->set_discount_tax( $this->get_total( 'discounts_tax_total' ) );
$this->cart->set_total_tax( array_sum( $this->get_merged_taxes( false ) ) );