WooCommerce Code Reference

SessionHandler extends WC_Session
in package

SessionHandler class

Table of Contents

$_customer_id  : int
Customer ID.
$_data  : array<string|int, mixed>
Session Data.
$_dirty  : bool
Dirty when the session needs saving.
$session_expiration  : int
Expiration timestamp.
$table  : string
Table name for session data.
$token  : string
Token from HTTP headers.
__construct()  : mixed
Constructor for the session class.
__get()  : mixed
Magic get method.
__isset()  : bool
Magic isset method.
__set()  : mixed
Magic set method.
__unset()  : mixed
Magic unset method.
cleanup_sessions()  : mixed
Cleanup session data. Extended by child classes.
get()  : array<string|int, mixed>|string
Get a session variable.
get_customer_id()  : int
Get customer ID.
get_session()  : string|array<string|int, mixed>|bool
Returns the session.
init()  : mixed
Init hooks and session data.
save_data()  : mixed
Save data and delete user session.
set()  : mixed
Set a session variable.
init_session_from_token()  : mixed
Process the token header to load the correct session.

Properties

Methods

__set()

Magic set method.

public __set(mixed $key, mixed $value) : mixed
Parameters
$key : mixed

Key to set.

$value : mixed

Value to set.

Return values
mixed

get()

Get a session variable.

public get(string $key[, mixed $default = null ]) : array<string|int, mixed>|string
Parameters
$key : string

Key to get.

$default : mixed = null

used if the session variable isn't set.

Return values
array<string|int, mixed>|stringvalue of session variable

get_session()

Returns the session.

public get_session(string $customer_id[, mixed $default = false ]) : string|array<string|int, mixed>|bool
Parameters
$customer_id : string

Customer ID.

$default : mixed = false

Default session value.

Return values
string|array<string|int, mixed>|bool

set()

Set a session variable.

public set(string $key, mixed $value) : mixed
Parameters
$key : string

Key to set.

$value : mixed

Value to set.

Return values
mixed

init_session_from_token()

Process the token header to load the correct session.

protected init_session_from_token() : mixed
Return values
mixed