WooCommerce redirects a user with HBook role to the front-end
🤔 Problem
I use WooCommerce and a user with HBook role is redirected to WooCommerce "my-account" page.
🌱 Solution
If you are using WooCommerce plugin and have created users with HBook roles, you should prevent WooCommerce redirection after login.
Please add this code to the functions.php of your child theme:
CODE
/* Disable WC redirection after login */
add_filter( 'woocommerce_prevent_admin_access', 'hbook_reservation_role_admin_access' );
function hbook_reservation_role_admin_access( $prevent_access ) {
if( current_user_can( 'read_resa' ) ) {
$prevent_access = false;
}
return $prevent_access;
}