Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1517
    phoenix04
    Participant

    Is it possible to use the User Role Editor Pro to disable the “Webhooks” tab under settings in Woocommerce for a particular User Group?

    We have found that we can disable the permission to add and edit Webhooks by removing the appropriate edit and create permissions, but cannot remove the “Webhooks TAB” under Woocommerce Settings. This is because when the user is given the permission to edit Woocommerce Settings, they also seem to get the permission to see the tab and therefore it still shows up.

    Is this possible to do this somehow, or is this something that can be added to this tool? We can try and remove this tab from the script for a particular user group, but that would take a lot of coding and affect our ability to upgrade Woocommerce in the future.

    #1522
    Vladimir
    Keymaster

    Create file wc-settings-remove-tab.php at the wp-content/mu-plugins folder and insert to it this code:

    
    <?php
    
    add_filter( 'woocommerce_settings_tabs_array', 'remove_webhooks', 25);
    
    function remove_webhooks($pages) {
    
      if (current_user_can('wc_manager_restricted')) {
        unset($pages['webhooks']);
      }
    
      return $pages;
    
    }
    

    Replace wc_manager_restricted with your role name or capability.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.