Help me hiding woocommerce store management section using admin css?

silumantu

Member
Oct 9, 2019
169
23
18
Please see the screenshot:

woo hide stock management tab 1.png

I am trying to hide the store management section either fully (1) or partially at least (2); but unable to do it. I tried to find the right element and when try to hide, it completely hide the whole page. I just want to hide this store management section 1 or 2.

So if anyone know the right css code please give me. Thanks in advance.
 

silumantu

Member
Oct 9, 2019
169
23
18
You just need to target the correct class.

In this case is this one:
1664370038928.png
Thanks.

I use this code:

.css-xuyuoy{
display: none!important;
}

But still the store management header is present.
fsdfsd.PNG

I can't fine right css or target class to hide it. Plz help.
 

guguk

Well-known member
Jul 19, 2019
1,150
828
113
Ottoman Empire
If you dont want to use this section you can remove completely?

Try this one (It can be display error when you click woocommerce main menu but sub menus will work)

paste this code your child theme functions.php file

Code:
function strposa( string $haystack, array $needles, int $offset = 0 ) : bool {
    foreach ( $needles as $needle ) {
        if ( strpos( $haystack, $needle, $offset ) !== false ) {
            return false; // stop on first true result
        }
    }

    return true;
}

function action_admin_menu() {
    // Contains the URI of the current page.
    $current_url = $_SERVER['REQUEST_URI'];

    // Pages that must remain accessible
    $should_still_work = array( 'customers', 'analytics', 'marketing' );
    
    // Make sure some wc-admin pages will still work
    if ( strposa( $current_url, $should_still_work ) ) {
        remove_submenu_page( 'woocommerce', 'wc-admin' );
    }
}
add_action( 'admin_menu', 'action_admin_menu', 99, 0 );
 
  • Like
Reactions: silumantu

silumantu

Member
Oct 9, 2019
169
23
18
You just need do inspect your site and choose the class of the element you want to hide. Check tutorials on youtube.

1664371438768.png
I tried by using that css class, but it did not worked properly.

See the screenshot:
error.PNG

Also after observing your way to finding right class of element, I am also trying, but unable to find the right one which works.

Capture333.PNG
 

silumantu

Member
Oct 9, 2019
169
23
18
If you dont want to use this section you can remove completely?

Try this one (It can be display error when you click woocommerce main menu but sub menus will work)

paste this code your child theme functions.php file

Code:
function strposa( string $haystack, array $needles, int $offset = 0 ) : bool {
    foreach ( $needles as $needle ) {
        if ( strpos( $haystack, $needle, $offset ) !== false ) {
            return false; // stop on first true result
        }
    }

    return true;
}

function action_admin_menu() {
    // Contains the URI of the current page.
    $current_url = $_SERVER['REQUEST_URI'];

    // Pages that must remain accessible
    $should_still_work = array( 'customers', 'analytics', 'marketing' );
   
    // Make sure some wc-admin pages will still work
    if ( strposa( $current_url, $should_still_work ) ) {
        remove_submenu_page( 'woocommerce', 'wc-admin' );
    }
}
add_action( 'admin_menu', 'action_admin_menu', 99, 0 );

Thanks for replay. Actually i want to keep the section, only want to hide the 'Store management' section. I am already using admin menu editor pro, so I could hide this menu item any time. But I just want to hide this subsection. Anyway, thanks for your replay.
 

guguk

Well-known member
Jul 19, 2019
1,150
828
113
Ottoman Empire
Thanks for replay. Actually i want to keep the section, only want to hide the 'Store management' section. I am already using admin menu editor pro, so I could hide this menu item any time. But I just want to hide this subsection. Anyway, thanks for your replay.
use this one:
.css-1pd4mph {display: none !important}
 
  • Like
Reactions: silumantu

silumantu

Member
Oct 9, 2019
169
23
18
As I said before you could not achive via CSS because used same class names in other "cards" so you should find a method whcih is "remove" section instead of "hiding"
Hmm, now I understand after so many trial-error. I guess there is no perfect way.
 

Hardii

Well-known member
Trusted Uploader
Jul 1, 2022
146
481
63
If store management section is the last section in your woocommerce dashboard try the following:

Code:
.woocommerce-homescreen-column > div:last-child {
  display: none !important;
}
 
  • Love
Reactions: silumantu

silumantu

Member
Oct 9, 2019
169
23
18
If store management section is the last section in your woocommerce dashboard try the following:

Code:
.woocommerce-homescreen-column > div:last-child {
  display: none !important;
}
WOWWWW. Finally your code is working perfectly without any issue. Thank you very very much @Hardii 🙏✌✌✌.
 
  • Like
Reactions: Hardii

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu