Merge pull request #20137 from woocommerce/fix/20135
Recalc taxes if address changes in API
This commit is contained in:
commit
6bbd598713
|
@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue