In a recent Twitter conversation, I reflected on one of the biggest challenges with WooCommerce — the cluttered WordPress admin sidebar.
With dozens of plugins installed, the admin menu quickly fills up with unrelated items, and WooCommerce’s own orders, payments, products, and settings are scattered across different areas. This fragmentation makes store management harder than it should be.
Inspired by this discussion, I decided to create a simple way to “take over” the admin area for WooCommerce store managers — a cleaner, streamlined admin view focusing solely on WooCommerce essentials like orders, products, and customers.
Here’s a code snippet that adds a toggle button in the admin bar, letting you switch to a WooCommerce-only admin menu and back. It also ensures the toggle stays active as you navigate, keeping your workflow smooth and intuitive.


PHP Snippet: Create a WooCommerce Store-Only Admin View @ WP Dashboard
Here’s a detailed explanation of what each section of the code below does.
1. Add toggle button in the admin bar
The first function adds a toggle button to the WordPress admin bar at the top of the screen. Depending on the current mode, it displays either a “Switch to Store Admin” button (with a cart icon) or a “Switch to WP Admin” button (with a generic settings icon).
Clicking the button doesn’t just change the page—it also triggers a cookie update that determines which mode you’re in. This makes switching between simplified WooCommerce management and the full WordPress dashboard quick and intuitive.
2. Handle mode switching with a cookie
The second function manages the actual switching logic. When the toggle button is clicked, it sets or deletes a store_admin cookie.
This cookie is used to remember the user’s preference between page loads, so once you switch to Store Admin mode you stay in that mode until you explicitly toggle back. A redirect cleans up the URL so no unnecessary parameters remain visible.
3. Filter admin menu to show only WooCommerce items in store admin mode
The third function customizes the sidebar menu when Store Admin mode is active. It removes any items unrelated to WooCommerce, leaving only the main WooCommerce menu, WooCommerce admin pages (slugs starting with wc- or containing woocommerce), and WooCommerce post types like products or orders.
This ensures that the sidebar is focused on store management without distractions from unrelated plugins or WordPress settings.
4. Append cosmetic parameter to admin URLs
An additional function optionally appends a store_admin=1 parameter to admin URLs when Store Admin mode is active.
This isn’t required for the logic to work (since the cookie is the real source of truth), but it can be useful for clarity or debugging. It helps visually confirm that the simplified mode is in effect as you navigate between pages.
5. Add custom CSS for the admin bar button
Finally, the snippet includes CSS that styles the toggle button in the admin bar. The button appears with a red background (#d63638), white text, and white icons for strong visibility. On hover, the red darkens slightly for better visual feedback. This makes the toggle easy to spot and intuitive to use.
Together, these sections provide a smooth and user-friendly way to switch the WordPress admin between a full view and a WooCommerce-focused “store admin” mode, making WooCommerce store management cleaner and more efficient:
/**
* @snippet "Store Admin" View @ WordPress Dashboard
* @tutorial https://businessbloomer.com/woocommerce-customization
* @author Rodolfo Melogli, Business Bloomer
* @compatible WooCommerce 10
* @community https://businessbloomer.com/club/
*/
// ================================
// ADD STORE ADMIN TOGGLE BUTTON
// ================================
function bbloomer_add_store_admin_toggle_button( $wp_admin_bar ) {
if ( ! current_user_can( 'manage_woocommerce' ) ) return;
$is_store_admin = isset( $_COOKIE['store_admin'] ) && $_COOKIE['store_admin'] == '1';
$url = add_query_arg( 'toggle_store_admin', $is_store_admin ? '0' : '1', admin_url( 'admin.php?page=wc-orders' ) );
$wp_admin_bar->add_node( [
'id' => 'store-admin-toggle',
'title' => $is_store_admin
? '<span class="ab-icon dashicons dashicons-admin-generic"></span> Switch to WP Admin'
: '<span class="ab-icon dashicons dashicons-cart"></span> Switch to Store Admin',
'href' => $url,
] );
}
add_action( 'admin_bar_menu', 'bbloomer_add_store_admin_toggle_button', 100 );
// ================================
// SET / DELETE COOKIE ON TOGGLE
// ================================
function bbloomer_handle_store_admin_toggle() {
if ( ! current_user_can( 'manage_woocommerce' ) ) return;
if ( isset( $_GET['toggle_store_admin'] ) ) {
if ( $_GET['toggle_store_admin'] == '1' ) {
setcookie( 'store_admin', '1', time() + DAY_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
$_COOKIE['store_admin'] = '1'; // so it's immediately available
} else {
setcookie( 'store_admin', '', time() - 3600, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
unset( $_COOKIE['store_admin'] );
}
// Redirect to clean URL (remove toggle param)
wp_safe_redirect( remove_query_arg( 'toggle_store_admin' ) );
exit;
}
}
add_action( 'admin_init', 'bbloomer_handle_store_admin_toggle' );
// ================================
// FILTER ADMIN MENU IN STORE MODE
// ================================
function bbloomer_filter_admin_menu_for_store_admin() {
if ( ! current_user_can( 'manage_woocommerce' ) ) return;
if ( ! isset( $_COOKIE['store_admin'] ) || $_COOKIE['store_admin'] != '1' ) return;
global $menu;
foreach ( $menu as $key => $item ) {
$slug = $item[2];
$is_woo = (
$slug === 'woocommerce' ||
strpos( $slug, 'wc-' ) === 0 ||
strpos( $slug, 'woocommerce' ) !== false ||
strpos( $slug, 'edit.php?post_type=shop_' ) === 0 ||
strpos( $slug, 'edit.php?post_type=product' ) === 0
);
if ( ! $is_woo ) {
remove_menu_page( $slug );
}
}
}
add_action( 'admin_menu', 'bbloomer_filter_admin_menu_for_store_admin', 9999 );
// ================================
// APPEND COOKIE MODE TO ADMIN_URLS
// ================================
function bbloomer_add_store_admin_param_to_admin_urls( $url, $path, $scheme ) {
if ( ! isset( $_COOKIE['store_admin'] ) || $_COOKIE['store_admin'] != '1' ) return $url;
return add_query_arg( 'store_admin', '1', $url ); // purely cosmetic if needed
}
add_filter( 'admin_url', 'bbloomer_add_store_admin_param_to_admin_urls', 10, 3 );
// ================================
// STYLES FOR TOGGLE BUTTON
// ================================
function bbloomer_store_admin_button_styles() {
?>
<style>
#wp-admin-bar-store-admin-toggle > .ab-item {
background-color: #d63638;
color: #fff;
}
#wp-admin-bar-store-admin-toggle:hover > .ab-item {
background-color: #b52d2f;
}
#wp-admin-bar-store-admin-toggle > .ab-item .dashicons {
color: #fff;
}
</style>
<?php
}
add_action( 'admin_head', 'bbloomer_store_admin_button_styles' );









This is wonderful, thank you very much for your effort.
To have the result shown on the image we must add the whole code? Im interested only to “Add toggle button in the admin bar”
Yes, because if you then click the button nothing will happen, so the rest of the code is necessary 🙂
The function that keeps the parameter in the URL doesn’t work. When I go to view orders, products, or whatever, store_Admin disappears from the URL, and I see the original menu again. I’ve changed the priority, but it still doesn’t work. bbloomer _append_store_admin_param_to_admin_url
Can you try with the new code? I’ve now added a cookie that should make that work
When switching to Woocommerce mode it opens the orders page and the admin menu is reduced and focussed, very nice! The button also indicates ‘Switch to WP Admin’.
https://snipboard.io/M7ycXx.jpg
However, if i select any other menu item the complete admin menu returns and the button changes to ‘Switch to Store Admin’
https://snipboard.io/gJMZ1N.jpg
I assume this is not the intention as the admin menus should only return when the button is clicked.
Hi Cor can you try with the new code? I’ve now added a cookie that should make that work
Excellent, working as intended now. Grazie Rodolfo!
Yay!
Thank you for sharing this code. Unfortunately, I encountered an issue with it. When I’m in Store Admin mode and click on one of the WooCommerce menus (e.g., Orders), the admin page resets to its default state (WP Admin mode).
Hello Benjamin can you try with the new code? I’ve now added a cookie that should make that work
Yes! The new code works properly. Thanks, Rodolfo!
Nice!