Shop Manager only list users

WooCommerce built-in role “Shop Manager” (shop_manager) by default can see the list of users and edit/delete users with ‘Customer’ role. What if you wish that shop manager can only see the list of users, but can not edit/delete them?

Shop Manager can not edit user
Shop Manager can not edit user

Direct step is open ‘shop_manager’ role in User Role Editor and revoke ‘edit_users’ and ‘delete_users’ capabilities from it. But you will see that this role has the only ‘list_users’ capability in the “Users” group:

Shop Manager list users capability
Shop Manager list users capability

What’s the mess? How such role can edit users with ‘Customer’ role? WooCommerce adds to shop_manager permissions to edit users the fly (got from the woocommerce/includes/wc-user-functions.php, version 6.4.1):

WooCommerce allows shop manager to edit customer user
WooCommerce allows shop manager to edit customer user

Really shop_manager can edit only users with ‘customer’ role. WooCommerce manage this using this code:

shop manager can edit customers only
Shop manager can edit customers only

shop manager can edit customers only
Shop manager can edit customers only

As you can see from lines 505 and 543 WooCommerce allows to change this via woocommerce_shop_manager_editable_roles filter. So returning to our prime purpose – prohibit to Shop Manager edit users, we can use this code:

add_filter('woocommerce_shop_manager_editable_roles', 'shop_manager_read_only', 10, 1);

function shop_manager_read_only( $roles ) {
    return array();
}

Just place it to the end of the active theme functions.php file or put on the site as a Must Use plugin. Shop Manager will can not edit users with customer role as a result.

Restrict selected WooCommerce reports

Admin menu item “WooCommerce->Reports” is protected by ‘view_woocommerce_reports’ user capability. User with this capability has access to WooCommerce reports page. This page contains several tabs: “Orders”, “Customers”, “Stock”, “Taxes”. Is it possible to restrict selected reports (tabs) for the selected role? Read more Restrict selected WooCommerce reports

Show for the role WooCommerce orders with selected status only

Is it possible to show for the role WooCommerce orders with the selected status(es) only?
User Role Editor Pro does not include such functionality directly. It’s possible to add such kind of restriction to User Role Editor (URE) using URE built-in additional options for role interface and piece of the custom PHP code.
Read more Show for the role WooCommerce orders with selected status only