From 40d23710c609c7a6c0edb0ef8a8dcedeae779994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9sz=C3=A1ros=20R=C3=B3bert?= Date: Thu, 9 Apr 2020 10:15:10 +0300 Subject: [PATCH] Return the SessionHandler if WC session is null Without this REST API request on the admin side return 500 as the is_admin check is not enough --- modules.local/ppcp-session/services.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules.local/ppcp-session/services.php b/modules.local/ppcp-session/services.php index d743a4a58..983c52c3f 100644 --- a/modules.local/ppcp-session/services.php +++ b/modules.local/ppcp-session/services.php @@ -13,6 +13,9 @@ return [ if (is_admin()) { return new SessionHandler(); } + if (is_null(WC()->session)) { + return new SessionHandler(); + } $result = WC()->session->get(SessionHandler::ID); if (is_a($result, SessionHandler::class)) { return $result;