WC_Session_Handler::maybe_update_nonce_user_logged_outpublicWC 5.3.0

When a user is logged out, ensure they have a unique nonce to manage cart and more using the customer/session ID. This filter runs everything wp_verify_nonce() wp_create_nonce() called.

Method of the class: WC_Session_Handler{}

No Hooks.

Returns

Int|String.

Usage

$WC_Session_Handler = new WC_Session_Handler();
$WC_Session_Handler->maybe_update_nonce_user_logged_out( $uid, $action );
$uid(int) (required)
User ID.
$action(int|string) (required)
The nonce action.

Changelog

Since 5.3.0 Introduced.

WC_Session_Handler::maybe_update_nonce_user_logged_out() code WC 10.3.3

public function maybe_update_nonce_user_logged_out( $uid, $action ) {
	if ( is_string( $action ) && StringUtil::starts_with( $action, 'woocommerce' ) ) {
		return $this->has_session() && $this->get_customer_id() ? $this->get_customer_id() : $uid;
	}
	return $uid;
}