• Resolved Javier

    (@vaporlibre)


    I need to disable the option “Wc-reports”, not only so that it is not displayed, but also so that it does not consume resources. Thank you.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • I haven’t tried it, but there’s actually a plugin for this called Disable Dashboard for WooCommerce.

    Thread Starter Javier

    (@vaporlibre)

    Thanks for your answer, but I’m actually trying to remove as much of my website as possible, I need some code to deactivate it, a plugin does not work for me, since I need to save resources. Thank you

    I understand completely. I always go the route of a little code rather than a plugin if possible; however, if you take a look at this plugin, it’s only a few lines of code in one file plus the readme. Total disk space it will take is 2.7 KB. I don’t think it will be any more load on your server than a code snippet.

    Thread Starter Javier

    (@vaporlibre)

    Perfect, I didn’t know that, thank you very much, I’ll do it this way

    Thread Starter Javier

    (@vaporlibre)

    Sorry to inform you that the “reports” part is still active, I think that plugin only disables analytics

    The Reports part pre-dates WooCommerce 4.0, doesn’t it? I was thinking you wanted to get rid of the new Analytics, Dashboard, javascript Admin, and all the new stuff they’ve added with v. 4.0, including the database tables for them described in the readme for the plugin. I don’t think the old Reports will hurt you much unless you use it.

    Thread Starter Javier

    (@vaporlibre)

    yes, that comes before 4.0, is there a way to disable it using some line of code. Thank you

    According to this post, if your goal is to reduce resource usage, it doesn’t sound like it’s necessary unless you’re worried about users clicking the link; if you don’t click the link, it doesn’t use any resources.

    If you want to hide the submenu item, it seems like according to this article, you could use the following, but I couldn’t get it to work:

    
    function custom_menu_page_removing() {
      remove_submenu_page('admin.php', 'wc-reports');
    }
    add_action('admin_menu', 'custom_menu_page_removing', 110);
    

    You might post a new thread specifically about removing the WooCommerce “Reports” submenu and get more responses. If you do, please link to it here. I am curious why that code doesn’t work. It may be firing before the WooCommerce menus are registered.

    Thread Starter Javier

    (@vaporlibre)

    Sorry this code doesn’t work. I already disabled analytics completely, but I would also like to do the same with reports

    I figured it out! I was using the wrong slug for the parent menu. I found the answer using the code contributed by Aurovrata Venet on the remove_submenu_page in the Codex to find the correct slug:

    
    global $submenu;
    error_log(print_r($submenu, true));
    

    With that information, the code to hide the “Reports” submenu is:

    
    function custom_menu_page_removing() {
      remove_submenu_page('woocommerce', 'wc-reports');
    }
    add_action('admin_menu', 'custom_menu_page_removing', 110);
    

    That removed the “Reports” submenu for me with and without the new Analytics disabled.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How can I disable woocommerce reports?’ is closed to new replies.