How to hide cart page checkout button for some user role in woocommerce hope there are some codes that I can use for function.php, thank you
How to hide cart page checkout button for some user role in woocommerce hope there are some codes that I can use for function.php, thank you
Check this sample code. Here I remove the proceed to checkout button for the editor role users.
function remove_proceed_to_checkout_button() {
if( is_user_logged_in() ) {
$user_id = get_current_user_id();
$get_user_data = get_userdata( $user_id );
$role = $get_user_data->roles[0];
if('editor' == $role ) {
remove_action('woocommerce_proceed_to_checkout', 'woocommerce_button_proceed_to_checkout', 20 );
}
}
}
add_action('init', 'remove_proceed_to_checkout_button');
Hope this will help.