wc_set_customer_auth_cookie()
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() wc set customer auth cookie code WC 9.4.2
function wc_set_customer_auth_cookie( $customer_id ) { wp_set_current_user( $customer_id ); wp_set_auth_cookie( $customer_id, true ); // Update session. if ( is_callable( array( WC()->session, 'init_session_cookie' ) ) ) { WC()->session->init_session_cookie(); } }