Update the checkout order endpoint allowed order statuses for payment complete (https://github.com/woocommerce/woocommerce-blocks/pull/12018)

* Update the allowed order statuses for payment complete

* Check if order exists before checking needs_payment
This commit is contained in:
Hsing-yu Flowers 2023-12-07 11:09:19 -05:00 committed by GitHub
parent d959781fc6
commit 2578fa11e9
1 changed files with 1 additions and 1 deletions

View File

@ -100,7 +100,7 @@ class CheckoutOrder extends AbstractCartRoute {
$order_id = absint( $request['id'] );
$this->order = wc_get_order( $order_id );
if ( $this->order->get_status() !== 'pending' && $this->order->get_status() !== 'failed' ) {
if ( ! $this->order || ! $this->order->needs_payment() ) {
return new \WP_Error(
'invalid_order_update_status',
__( 'This order cannot be paid for.', 'woo-gutenberg-products-block' )