Fix not approved order processing

This commit is contained in:
Alex P 2023-11-16 10:24:56 +02:00
parent 91c6e55f3d
commit 2dcfd115a9
No known key found for this signature in database
GPG key ID: 54487A734A204D71
2 changed files with 5 additions and 3 deletions

View file

@ -85,7 +85,11 @@ class ReturnUrlEndpoint {
// phpcs:enable WordPress.Security.NonceVerification.Recommended
$order = $this->order_endpoint->order( $token );
$this->session_handler->replace_order( $order );
if ( $order->status()->is( OrderStatus::APPROVED )
|| $order->status()->is( OrderStatus::COMPLETED )
) {
$this->session_handler->replace_order( $order );
}
$wc_order_id = (int) $order->purchase_units()[0]->custom_id();
if ( ! $wc_order_id ) {

View file

@ -286,8 +286,6 @@ class OrderProcessor {
ApplicationContext::USER_ACTION_PAY_NOW
);
$this->add_paypal_meta( $wc_order, $order, $this->environment );
return $order;
}