Okay
  Public Ticket #3447281
Hide Sales Agent Commissions from Sales Agents on order edit screen
Closed

Comments

  •  10
    Justin started the conversation

    Sales Agents can view the Sales Agent Commissions section when editing an order. Is it possible to make it so only admins can see that block?  Or at least only be able to select their sub-agents and not themselves or other agents?

    Attached files:  Screen Shot 2023-08-29 at 1.18.12 PM.png

  •  1,906
    WebWizards replied

    Hi Justin,

    I checked: the plugin sets this so that all users who have the "manage_woocommerce" capability can see that box. Normal agents wouldn't be able to see it.


    Usually "manage_woocommerce" is a capability that the shop manager has, as it gives a lot of permissions, changing shop settings, etc - it's something only very few users would have.


    I am not sure how this works on your site or whether you have a different setup. Normally we would advise to give agents the 'customer' role only.


    Kind regards,

    Stefan

  •  10
    Justin replied

    We created a custom role called Sales Agent because we need them to have access to a couple of functions in other plugins and giving them that permission seems to be the only way to do it. Let me see if I can hide it another way. Thanks.

  •  10
    Justin replied

    I've accomplished this with some custom css and PHP for now.

    ```function enqueuing_admin_scripts(){
      if (current_user_can('sales_agent')) {
          // Enqueue the custom CSS file
          wp_enqueue_style('salesagent-styles', get_stylesheet_directory_uri() . '/salesagent-styles.css');
      }
    }
    add_action( 'admin_enqueue_scripts', 'enqueuing_admin_scripts' );```


    ```  #poststuff #salesking_order_commission_metabox {

    display: none !important;
    } ```



  •   WebWizards replied privately
  •  10
    Justin replied

    Wonderful, thank you!