From f945f9a01594d94ad42927978fef9a2e11035c43 Mon Sep 17 00:00:00 2001 From: vedanshujain Date: Wed, 30 Dec 2020 19:20:51 +0530 Subject: [PATCH] Add protective check to make sure WC()->session is initialized before loading the data store. --- includes/class-wc-customer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-customer.php b/includes/class-wc-customer.php index 641ee9be34b..3c5c53079f3 100644 --- a/includes/class-wc-customer.php +++ b/includes/class-wc-customer.php @@ -111,7 +111,7 @@ class WC_Customer extends WC_Legacy_Customer { } // If this is a session, set or change the data store to sessions. Changes do not persist in the database. - if ( $is_session ) { + if ( $is_session && isset( WC()->session ) ) { $this->data_store = WC_Data_Store::load( 'customer-session' ); $this->data_store->read( $this ); }