wc_set_customer_auth_cookie()WC 1.0

Login a customer (set auth cookie and set global user object).

No Hooks.

Return

null. Nothing (null).

Usage

wc_set_customer_auth_cookie( $customer_id );
$customer_id(int) (required)
Customer ID.

wc_set_customer_auth_cookie() code WC 8.7.0

function wc_set_customer_auth_cookie( $customer_id ) {
	wp_set_current_user( $customer_id );
	wp_set_auth_cookie( $customer_id, true );

	// Update session.
	WC()->session->init_session_cookie();
}