get( 'session.cancellation.controller' ); /** * The Cancel controller. * * @var CancelController $controller */ $controller->run(); } ); add_action( 'ppcp_session_get_order', function ( ?Order $order, SessionHandler $session_handler ) use ( $c ): void { if ( ! isset( WC()->session ) ) { return; } if ( $this->reloaded_order ) { return; } if ( ! $order ) { return; } if ( $order->status()->is( OrderStatus::APPROVED ) || $order->status()->is( OrderStatus::COMPLETED ) ) { return; } $order_endpoint = $c->get( 'api.endpoint.order' ); assert( $order_endpoint instanceof OrderEndpoint ); $this->reloaded_order = true; try { $session_handler->replace_order( $order_endpoint->order( $order->id() ) ); } catch ( Throwable $exception ) { $logger = $c->get( 'woocommerce.logger.woocommerce' ); assert( $logger instanceof LoggerInterface ); $logger->warning( 'Failed to reload PayPal order in the session: ' . $exception->getMessage() ); } }, 10, 2 ); } /** * Returns the key for the module. * * @return string|void */ public function getKey() { } }