WC_Session_Handler::maybe_update_nonce_user_logged_out()publicWC 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.

Return

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(string) (required)
The nonce action.

Changelog

Since 5.3.0 Introduced.

WC_Session_Handler::maybe_update_nonce_user_logged_out() code WC 9.3.3

public function maybe_update_nonce_user_logged_out( $uid, $action ) {
	if ( Automattic\WooCommerce\Utilities\StringUtil::starts_with( $action, 'woocommerce' ) ) {
		return $this->has_session() && $this->_customer_id ? $this->_customer_id : $uid;
	}

	return $uid;
}