If the woocommerce_login_widget_redirect hook doesn’t work, it is because the redirection occurs even earlier, in the core wp_signon function. so we need to hook on to wp_login instead, for example
// allow user to redirect to the same page from the place that they login. The exception is wp-login.php add_action( 'wp_login', 'my_login_redirect', 2, 2 ); function my_login_redirect( $login, $user ) { if ($_SERVER['REQUEST_URI'] != '/wp-login.php') { // redirect to the referrer wp_safe_redirect($_SERVER['HTTP_REFERER']); exit; } }