Automattic\WooCommerce\Internal\Admin

Homescreen::is_admin_user()public staticWC 1.0

Check if the user can access the top-level WooCommerce item.

Method of the class: Homescreen{}

No Hooks.

Return

true|false.

Usage

$result = Homescreen::is_admin_user();

Homescreen::is_admin_user() code WC 7.1.0

public static function is_admin_user() {
	if ( ! class_exists( 'WC_Admin_Menus', false ) ) {
		include_once WC_ABSPATH . 'includes/admin/class-wc-admin-menus.php';
	}
	if ( method_exists( 'WC_Admin_Menus', 'can_view_woocommerce_menu_item' ) ) {
		return \WC_Admin_Menus::can_view_woocommerce_menu_item() || current_user_can( 'manage_woocommerce' );
	} else {
		// We leave this line for WC versions <= 6.2.
		return current_user_can( 'edit_others_shop_orders' ) || current_user_can( 'manage_woocommerce' );
	}
}