From 602254851a09089856de5e80f61b673976327cfa Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 26 Aug 2014 15:39:15 +0100 Subject: [PATCH] Reset fees before calculating/adding them again Fixes #6090 @claudiosmweb Do you see any issues with this? --- includes/class-wc-cart.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/class-wc-cart.php b/includes/class-wc-cart.php index 598d280de54..2fa10e76cc0 100644 --- a/includes/class-wc-cart.php +++ b/includes/class-wc-cart.php @@ -111,6 +111,8 @@ class WC_Cart { 'shipping_total' => 0, 'shipping_tax_total' => 0, 'coupon_discount_amounts' => array(), + 'fee_total' => 0, + 'fees' => array() ); add_action( 'init', array( $this, 'init' ), 5 ); // Get cart on init @@ -1876,6 +1878,9 @@ class WC_Cart { * Calculate fees */ public function calculate_fees() { + // Reset fees before calculation + $this->fee_total = 0; + $this->fees = array(); // Fire an action where developers can add their fees do_action( 'woocommerce_cart_calculate_fees', $this );