Skip to main content
Skip table of contents

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;
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.