Store order info in wc order meta to get if there is no session.

This commit is contained in:
Narek Zakarian 2022-05-10 18:46:40 +04:00
parent f78dfac648
commit ab0e90dab0
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;