WC_Cart_Session::find_cookie_by_name()privateWC 1.0

Find a cookie by name in an array of cookies.

Method of the class: WC_Cart_Session{}

No Hooks.

Return

Mixed. Key of the cookie if found, false if not.

Usage

// private - for code of main (parent) class only
$result = $this->find_cookie_by_name( $cookie_name, $cookies );
$cookie_name(string) (required)
Name of the cookie to find.
$cookies(array) (required)
Array of cookies to search.

WC_Cart_Session::find_cookie_by_name() code WC 9.2.3

private function find_cookie_by_name( $cookie_name, $cookies ) {
	foreach ( $cookies as $key => $cookie ) {
		if ( strpos( $cookie, $cookie_name ) !== false ) {
			return $key;
		}
	}
	return false;
}