Add protective check to make sure WC()->session is initialized before loading the data store.

This commit is contained in:
vedanshujain 2020-12-30 19:20:51 +05:30
parent 9db6e2e49c
commit f945f9a015
1 changed files with 1 additions and 1 deletions

View File

@ -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 );
}