You can choose to restrict or enable shipping methods by user roles. In WooCommerce > Settings > Members Only > Shipping Methods, you’ll see a list of all the shipping methods enabled on your site.
Under each shipping method, there’s a field for ‘Restricted roles’ and a field for ‘Permitted roles’.
If you want to prevent users with specific roles from using a certain shipping method, enter the roles in the ‘Restricted roles’ field.
If, on the other hand, you want to enable the shipping method for certain roles, enter those roles in the ‘Permitted roles’ field.
You can also add a filter to ignore any non-logged-in users from these rules:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wcmo_ignore_shipping_for_non_logged_in', '__return_true' ); |