woocommerce_rest_customer_allowed_roles filter-hookWC 9.5.2

Filter the allowed roles for the REST API.

Danger: Make sure that the roles listed here cannot manage the shop.

Usage

add_filter( 'woocommerce_rest_customer_allowed_roles', 'wp_kama_woocommerce_rest_customer_allowed_roles_filter' );

/**
 * Function for `woocommerce_rest_customer_allowed_roles` filter-hook.
 * 
 * @param array $roles Array of allowed roles.
 *
 * @return array
 */
function wp_kama_woocommerce_rest_customer_allowed_roles_filter( $roles ){

	// filter...
	return $roles;
}
$roles(array)
Array of allowed roles.

Changelog

Since 9.5.2 Introduced.

Where the hook is called

WC_REST_Customers_V1_Controller::allowed_roles()
woocommerce_rest_customer_allowed_roles
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-customers-v1-controller.php 156
return apply_filters( 'woocommerce_rest_customer_allowed_roles', array( 'customer', 'subscriber' ) );

Where the hook is used in WooCommerce

Usage not found.