Automattic\WooCommerce\StoreApi

SessionHandler::init_session_from_tokenprotectedWC 1.0

Process the token header to load the correct session.

Method of the class: SessionHandler{}

No Hooks.

Returns

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->init_session_from_token();

SessionHandler::init_session_from_token() code WC 10.8.1

protected function init_session_from_token() {
	$payload = CartTokenUtils::get_cart_token_payload( $this->token );

	$this->_customer_id       = $payload['user_id'];
	$this->session_expiration = $payload['exp'];
	$this->_data              = (array) $this->get_session( $this->get_customer_id(), array() );
}