woocommerce_guest_session_to_user_id хук-событиеWC 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.

Использование

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 int    $customer_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, $customer_id ){

	// action...
}
$guest_session_id(строка)
The former session ID, as generated by ::generate_customer_id().
$customer_id(int)
The Customer ID that the former session was converted to.

Список изменений

С версии 8.8.0 Введена.

Где вызывается хук

WC_Session_Handler::init_session_cookie()
woocommerce_guest_session_to_user_id
woocommerce/includes/class-wc-session-handler.php 124
do_action( 'woocommerce_guest_session_to_user_id', $guest_session_id, $this->_customer_id );

Где используется хук в WooCommerce

Использование не найдено.