Would you happen to know how to implement a session timeout when a customer is signed into the store?
We would like that when a customer logs into the store, if they remain inactive for like 15 minutes that it automatically signs them out. Currently I have this:
add_filter( ‘wc_session_expiration’, ‘woocommerce_cart_session_expires’);
function woocommerce_cart_session_expires() {
//Value is 15 minutes
return 60 * 15;
}
but it is not working.
If not, no worries, I know it’s not necessarily theme related.
Hey robertbwc,
Thank you for the inquiry.
We’ve found this hook that might help with what you’re trying to do:
// https://developer.wordpress.org/reference/hooks/auth_cookie_expiration/
Example:
function av_set_auth_cookie_expiration($expiration, $user_id, $remember) {
$expiration = 15 * MINUTE_IN_SECONDS;
return $expiration;
}
add_filter('auth_cookie_expiration', 'av_set_auth_cookie_expiration', 10, 3);
Best regards,
Ismael
Thank you, I will try it. You are very helpful.