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.
![How to Hide "Ship to a Different Address" Based on User Roles in WooCommerce? 1 How to Hide "Ship to a Different Address" Based on User Roles in WooCommerce? - Tyche Softwares](https://media.tychesoftwares.com/wp-content/uploads/Hide-Ship-to-a-different-address-based-on-the-User-Roles-in-WooCommerce-Checkout.png)
In another case, if the user logs in to any other roles, the “ship to a different address” section will be displayed.
![How to Hide "Ship to a Different Address" Based on User Roles in WooCommerce? 2 How to Hide "Ship to a Different Address" Based on User Roles in WooCommerce? - Tyche Softwares](https://media.tychesoftwares.com/wp-content/uploads/WooCommerce-Hide-Ship-to-a-different-address-section-based-on-user-roles.png)
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.