1. Home
  2. Docs
  3. Pick List
  4. Hooks & Custom Code
  5. Customize Which Users Can Be Assigned to Pick Orders

Customize Which Users Can Be Assigned to Pick Orders

By default, Pick List allows users with the roles:

  • administrator
  • shop_manager
  • plus any roles selected in Pick List → Settings


If you need more advanced control (for example: include custom roles, exclude specific users, or apply dynamic logic), you can use the following filters.

NOTE: From vs 2.6.2

1️⃣ Filter Allowed Roles (Before User Query)

Use this filter to modify the list of roles that are used when querying users.

add_filter( 'cas_picklist_allowed_roles', function( $roles ) {

	// Add a custom role
	$roles[] = 'warehouse_staff';

	// Remove administrators
	$roles = array_diff( $roles, [ 'administrator' ] );

	return $roles;

});

When to use this

  • You want to include a custom role (e.g. warehouse_staff)
  • You want to globally exclude a role
  • You want to restrict picking to a specific operational role

2️⃣ Filter Final User List (After Query)

If you need full control, you can filter the final list of users.

add_filter( 'cas_get_picklist_shop_managers', function( $users ) {

	return array_filter( $users, function( $user ) {
		// Example: exclude a specific user ID
		return $user->ID !== 5;
	});

});

Advanced Example – Allow Only Specific Users

add_filter( 'cas_get_picklist_shop_managers', function( $users ) {

	$allowed_ids = [ 12, 18, 25 ];

	return array_filter( $users, function( $user ) use ( $allowed_ids ) {
		return in_array( $user->ID, $allowed_ids, true );
	});

});

Performance Notes

  • Pick List caches the user list for 5 minutes using WordPress transients.
  • Changes to settings automatically refresh the cache.
  • If you dynamically change roles or users via custom code, you may want to clear the transient manually:
delete_transient( 'cas_pick_list_shop_managers' );

Best Practice

  • Use cas_picklist_allowed_roles when possible (more efficient).
  • Use cas_get_picklist_shop_managers when you need full logic control.

How can we help?