diff --git a/plugins/woocommerce/changelog/fix-50429-store-api-resuming-exclude-pending b/plugins/woocommerce/changelog/fix-50429-store-api-resuming-exclude-pending new file mode 100644 index 00000000000..515687a8a55 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-50429-store-api-resuming-exclude-pending @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Store API: Do not resume pending orders--create a new order instead diff --git a/plugins/woocommerce/src/StoreApi/Utilities/DraftOrderTrait.php b/plugins/woocommerce/src/StoreApi/Utilities/DraftOrderTrait.php index dedc60ae418..4e80f2695f8 100644 --- a/plugins/woocommerce/src/StoreApi/Utilities/DraftOrderTrait.php +++ b/plugins/woocommerce/src/StoreApi/Utilities/DraftOrderTrait.php @@ -60,8 +60,9 @@ trait DraftOrderTrait { return true; } - // Pending and failed orders can be retried if the cart hasn't changed. - if ( $order_object->needs_payment() && $order_object->has_cart_hash( wc()->cart->get_cart_hash() ) ) { + // Failed orders and those needing payment can be retried if the cart hasn't changed. + // Pending orders are excluded from this check since they may be awaiting an update from the payment processor. + if ( $order_object->needs_payment() && ! $order_object->has_status( 'pending' ) && $order_object->has_cart_hash( wc()->cart->get_cart_hash() ) ) { return true; }