Merge pull request #20137 from woocommerce/fix/20135

Recalc taxes if address changes in API
This commit is contained in:
Mike Jolley 2018-05-21 17:37:15 +01:00 committed by GitHub
commit 6bbd598713
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -532,7 +532,7 @@ class WC_REST_Orders_Controller extends WC_REST_Legacy_Orders_Controller {
} else { } else {
// If items have changed, recalculate order totals. // 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'] ) ) { 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 );
} }
} }

View File

@ -576,7 +576,7 @@ class WC_REST_Orders_V1_Controller extends WC_REST_Posts_Controller {
// If items have changed, recalculate order totals. // 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'] ) ) { 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(); return $order->get_id();