-
Home
-
WooCommerce
- Tips
How to Hide WooCommerce Admin Menus
function plt_hide_woocommerce_menus() {
//Hide "Payments".
remove_menu_page('wc-admin&path=/wc-pay-welcome-page');
//Hide "Tools → Scheduled Actions".
remove_submenu_page('tools.php', 'action-scheduler');
//Hide "WooCommerce".
remove_menu_page('woocommerce');
//Hide "WooCommerce → Home".
remove_submenu_page('woocommerce', 'wc-admin');
//Hide "WooCommerce → Orders".
remove_submenu_page('woocommerce', 'wc-orders');
//Hide "WooCommerce → Customers".
remove_submenu_page('woocommerce', 'wc-admin&path=/customers');
//Hide "WooCommerce → Reports".
remove_submenu_page('woocommerce', 'wc-reports');
//Hide "WooCommerce → Settings".
remove_submenu_page('woocommerce', 'wc-settings');
//Hide "WooCommerce → Status".
remove_submenu_page('woocommerce', 'wc-status');
//Hide "WooCommerce →".
remove_submenu_page('woocommerce', 'wc-addons');
//Hide "WooCommerce → Extensions".
remove_submenu_page('woocommerce', 'wc-admin&path=/extensions');
//Hide "Products".
remove_menu_page('edit.php?post_type=product');
//Hide "Products → All Products".
remove_submenu_page('edit.php?post_type=product', 'edit.php?post_type=product');
//Hide "Products → Add new product".
remove_submenu_page('edit.php?post_type=product', 'post-new.php?post_type=product');
//Hide "Products → Categories".
remove_submenu_page('edit.php?post_type=product', 'edit-tags.php?taxonomy=product_cat&post_type=product');
//Hide "Products → Tags".
remove_submenu_page('edit.php?post_type=product', 'edit-tags.php?taxonomy=product_tag&post_type=product');
//Hide "Products → Attributes".
remove_submenu_page('edit.php?post_type=product', 'product_attributes');
//Hide "Products → Reviews".
remove_submenu_page('edit.php?post_type=product', 'product-reviews');
//Hide "Analytics".
remove_menu_page('wc-admin&path=/analytics/overview');
//Hide "Analytics → Overview".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/overview');
//Hide "Analytics → Products".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/products');
//Hide "Analytics → Revenue".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/revenue');
//Hide "Analytics → Orders".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/orders');
//Hide "Analytics → Variations".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/variations');
//Hide "Analytics → Categories".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/categories');
//Hide "Analytics → Coupons".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/coupons');
//Hide "Analytics → Taxes".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/taxes');
//Hide "Analytics → Downloads".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/downloads');
//Hide "Analytics → Stock".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/stock');
//Hide "Analytics → Settings".
remove_submenu_page('wc-admin&path=/analytics/overview', 'wc-admin&path=/analytics/settings');
//Hide "Marketing".
remove_menu_page('woocommerce-marketing');
//Hide "Marketing → Overview".
remove_submenu_page('woocommerce-marketing', 'admin.php?page=wc-admin&path=/marketing');
//Hide "Marketing → Coupons".
remove_submenu_page('woocommerce-marketing', 'edit.php?post_type=shop_coupon');
}
add_action('admin_menu', 'plt_hide_woocommerce_menus', 100);
Where do I put this code?
How to Hide WooCommerce Meta Boxes
function plt_hide_woocommerce_metaboxes() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Hide the "Product data" meta box.
remove_meta_box('woocommerce-product-data', $screen->id, 'normal');
//Hide the "Product short description" meta box.
remove_meta_box('postexcerpt', $screen->id, 'normal');
//Hide the "Product gallery" meta box.
remove_meta_box('woocommerce-product-images', $screen->id, 'side');
//Hide the "Coupon data" meta box.
remove_meta_box('woocommerce-coupon-data', $screen->id, 'normal');
//Hide the "Order data" meta box.
remove_meta_box('woocommerce-order-data', $screen->id, 'normal');
//Hide the "Items" meta box.
remove_meta_box('woocommerce-order-items', $screen->id, 'normal');
//Hide the "Downloadable product permissions" meta box.
remove_meta_box('woocommerce-order-downloads', $screen->id, 'normal');
//Hide the "Order actions" meta box.
remove_meta_box('woocommerce-order-actions', $screen->id, 'side');
//Hide the "Order attribution" meta box.
remove_meta_box('woocommerce-order-source-data', $screen->id, 'side');
//Hide the "Order notes" meta box.
remove_meta_box('woocommerce-order-notes', $screen->id, 'side');
}
add_action('add_meta_boxes', 'plt_hide_woocommerce_metaboxes', 20);
How to Hide the "WooCommerce Setup" Dashboard Widget
function plt_hide_woocommerce_dashboard_widgets() {
$screen = get_current_screen();
if ( !$screen ) {
return;
}
//Remove the "WooCommerce Setup" widget.
remove_meta_box('wc_admin_dashboard_setup', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'plt_hide_woocommerce_dashboard_widgets', 20);