From faa09deff17dc528d94a5275ed7a93ba7b18ff0a Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 18 May 2018 21:47:04 +0100 Subject: [PATCH] Recalc taxes if address changes in API --- includes/api/class-wc-rest-orders-controller.php | 2 +- includes/api/v1/class-wc-rest-orders-controller.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/api/class-wc-rest-orders-controller.php b/includes/api/class-wc-rest-orders-controller.php index bfafc26054c..20b3df8e18b 100644 --- a/includes/api/class-wc-rest-orders-controller.php +++ b/includes/api/class-wc-rest-orders-controller.php @@ -532,7 +532,7 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller { } else { // If items have changed, recalculate order totals. if ( isset( $request['billing'] ) || isset( $request['shipping'] ) || isset( $request['line_items'] ) || isset( $request['shipping_lines'] ) || isset( $request['fee_lines'] ) || isset( $request['coupon_lines'] ) ) { - $object->calculate_totals(); + $object->calculate_totals( true ); } } diff --git a/includes/api/v1/class-wc-rest-orders-controller.php b/includes/api/v1/class-wc-rest-orders-controller.php index 3ac67a2eda3..804e3fb571e 100644 --- a/includes/api/v1/class-wc-rest-orders-controller.php +++ b/includes/api/v1/class-wc-rest-orders-controller.php @@ -576,7 +576,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller { // If items have changed, recalculate order totals. if ( isset( $request['billing'] ) || isset( $request['shipping'] ) || isset( $request['line_items'] ) || isset( $request['shipping_lines'] ) || isset( $request['fee_lines'] ) || isset( $request['coupon_lines'] ) ) { - $order->calculate_totals(); + $order->calculate_totals( true ); } return $order->get_id();