Merge pull request #641 from woocommerce/PCP-580-manual-orders-return-an-error-for-guest-users

Store order info in wc order meta to get if there is no session.
This commit is contained in:
Emili Castells 2022-05-17 13:55:35 +02:00 committed by GitHub
commit b7c4f23b62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 7 deletions

View file

@ -150,7 +150,8 @@ class OrderProcessor {
* @return bool
*/
public function process( \WC_Order $wc_order ): bool {
$order = $this->session_handler->order();
$order_id = $wc_order->get_meta( PayPalGateway::ORDER_ID_META_KEY );
$order = $this->session_handler->order() ?? $this->order_endpoint->order( $order_id );
if ( ! $order ) {
$this->last_error = __( 'No PayPal order found in the current WooCommerce session.', 'woocommerce-paypal-payments' );
return false;