Support » Plugin: User role based shipping methods » Not limiting to select user roles

  • daspi


    I can not limit which user roles see only selected shipping methods. It is enabled too. I have selected that Admin would see only local_pickup:3. But I still see all my other shipping methods displayed on front end. It seems to have no effect.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author pluginvallies



    To show admin only local pickup:3 you have to configure all other shipping method in the plugin to hide. Also after configuring you have to change the shipping address in cart else it show you the cached data.

    I am having the same problem. I ship to 2 different countries and each has 2 shipping methods (1 flat rate + 1 free shipping) for customers and 2 (1 flat rate + 1 free shipping) for wholesale users. I have configured all 8 profiles but when trying to check out it still shows both shipment methods?

    Are there any hidden profiles that need to be configured? I also tried to do the debug / cache trick but that didn’t work either and a hard reset/icognito mode.

    Thread Starter daspi


    I ended up using this code to achieve what I wanted.

    /* ** Handle Local Pickup by User Role ** */
    add_filter(‘woocommerce_package_rates’, ‘hide_local_pickup_based_on_user_role’, 30, 2);
    function hide_local_pickup_based_on_user_role($rates, $package) {
    foreach($rates as $rate_key => $rate){
    if($rate->method_id === ‘local_pickup’){
    if(!current_user_can(‘local_pickup_allowed’) || !is_user_logged_in()){
    return $rates;
    /* ** End Local Pickup ** */

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not limiting to select user roles’ is closed to new replies.