WC_Session::get( string $key, mixed $default = null )

Get a session variable.


Description Description


Parameters Parameters

$key

(Required) Key to get.

$default

(Optional) used if the session variable isn't set.

Default value: null


Top ↑

Return Return

(array|string) value of session variable


Top ↑

Source Source

File: includes/abstracts/abstract-wc-session.php

	public function get( $key, $default = null ) {
		$key = sanitize_key( $key );
		return isset( $this->_data[ $key ] ) ? maybe_unserialize( $this->_data[ $key ] ) : $default;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.