Store API: Do not resume orders with `pending` status (#50531)

* Do not resume pending orders

* changelog
This commit is contained in:
Mike Jolley 2024-08-16 11:02:41 +01:00 committed by GitHub
parent 5f43827f7f
commit 3170acd1b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Store API: Do not resume pending orders--create a new order instead

View File

@ -60,8 +60,9 @@ trait DraftOrderTrait {
return true; return true;
} }
// Pending and failed orders can be retried if the cart hasn't changed. // Failed orders and those needing payment can be retried if the cart hasn't changed.
if ( $order_object->needs_payment() && $order_object->has_cart_hash( wc()->cart->get_cart_hash() ) ) { // 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; return true;
} }