WC_Session_Handler::restore_session_data │ private │ WC 10.0.0

Restore the session data from the database.

Метод класса: WC_Session_Handler{}

Хуки из метода

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->restore_session_data();

Список изменений

С версии 10.0.0 Введена.

Код WC_Session_Handler::restore_session_data() WC 11.2.2

private function restore_session_data() {
	$session_data = $this->get_session_data();

	/**
	 * Filters the session data when restoring from storage during initialization.
	 *
	 * This filter allows you to:
	 * 1. Modify the session data before it's loaded, including adding or removing specific session data entries
	 * 2. Clear the entire session by returning an empty array
	 *
	 * Note: If the filtered data is empty, the session will be destroyed and the
	 * guest's session cookie will be removed. This can be useful for high-traffic
	 * sites that prioritize page caching over maintaining all session data.
	 *
	 * @since 9.9.0
	 *
	 * @param array $session_data The session data loaded from storage.
	 * @return array Modified session data to be used for initialization.
	 */
	$this->_data = (array) apply_filters( 'woocommerce_restored_session_data', $session_data );
}