wc_shop_manager_has_capability()WC 3.5.4

Safe way of allowing shop managers restricted capabilities that will remove access to the capabilities if WooCommerce is deactivated.

No Hooks.




wc_shop_manager_has_capability( $allcaps, $caps, $args, $user );
$allcaps(bool[]) (required)
Array of key/value pairs where keys represent a capability name and boolean values represent whether the user has that capability.
$caps(string[]) (required)
Required primitive capabilities for the requested capability.
$args(array) (required)
Arguments that accompany the requested capability check.
$user(WP_User) (required)
The user object.


Since 3.5.4 Introduced.

wc_shop_manager_has_capability() code WC 7.7.0

function wc_shop_manager_has_capability( $allcaps, $caps, $args, $user ) {

	if ( wc_user_has_role( $user, 'shop_manager' ) ) {
		// @see wc_modify_map_meta_cap, which limits editing to customers.
		$allcaps['edit_users'] = true;

	return $allcaps;