woocommerce_guest_session_to_user_id action-hookWC 8.8.0

Fires after a customer has logged in, and their guest session id has been deleted with its data migrated to a customer id.

This hook gives extensions the chance to connect the old session id to the customer id, if the key is being used externally.

Usage

add_action( 'woocommerce_guest_session_to_user_id', 'wp_kama_woocommerce_guest_session_to_user_id_action', 10, 2 );

/**
 * Function for `woocommerce_guest_session_to_user_id` action-hook.
 * 
 * @param string $guest_session_id The former session ID, as generated by `::generate_customer_id()`.
 * @param string $user_session_id  The Customer ID that the former session was converted to.
 *
 * @return void
 */
function wp_kama_woocommerce_guest_session_to_user_id_action( $guest_session_id, $user_session_id ){

	// action...
}
$guest_session_id(string)
The former session ID, as generated by ::generate_customer_id().
$user_session_id(string)
The Customer ID that the former session was converted to.

Changelog

Since 8.8.0 Introduced.

Where the hook is called

WC_Session_Handler::migrate_guest_session_to_user_session()
woocommerce_guest_session_to_user_id
woocommerce/includes/class-wc-session-handler.php 239
do_action( 'woocommerce_guest_session_to_user_id', $guest_session_id, $user_session_id );

Where the hook is used in WooCommerce

Usage not found.