From f358e4ce8eeb82615810180a729808b6a1304102 Mon Sep 17 00:00:00 2001 From: Nadir Seghir Date: Mon, 18 Oct 2021 12:18:06 +0100 Subject: [PATCH] use Cart needs payment instead of Order needs payment --- src/StoreApi/Routes/Checkout.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/StoreApi/Routes/Checkout.php b/src/StoreApi/Routes/Checkout.php index 5d6d223113c..2a0ff2acd81 100644 --- a/src/StoreApi/Routes/Checkout.php +++ b/src/StoreApi/Routes/Checkout.php @@ -462,7 +462,9 @@ private function update_customer_from_request( \WP_REST_Request $request ) { */ private function update_order_from_request( \WP_REST_Request $request ) { $this->order->set_customer_note( $request['customer_note'] ?? '' ); - $this->order->set_payment_method( $this->order->needs_payment() ? $this->get_request_payment_method( $request ) : '' ); + + $cart = $this->cart_controller->get_cart_instance(); + $this->order->set_payment_method( $cart->needs_payment() ? $this->get_request_payment_method( $request ) : '' ); /** * Fires when the Checkout Block/Store API updates an order's from the API request data.