Whether your store has numerous user roles like customers, subscribers, or wholesalers, this snippet will help you to hide the “Ship to a different address” section based on the user role.
add_action('init', 'ts_unset_shipping_address' );
function ts_unset_shipping_address() {
// HERE the targeted user roles
$user_roles = array('Customer');
// Check user roles to hide “Ship to a different address”
foreach( $user_roles as $user_role ) {
if ( current_user_can( sanitize_title( $user_role ) ) ) {
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_false');
break;
}
}
}
Output
If the user is logged in with a ‘customer’ role, then it will hide the ‘ship to a different address’ section as shown below.

In another case, if the user logs in to any other roles, the “ship to a different address” section will be displayed.

Additionally, if you want to remove the option of entering a different shipping address for all users, then you can check this article that explains how to hide the “ship to a different address” checkbox in WooCommerce without any conditions.
