How to remove unnecessary features from WooCommerce

woo develop

Since version 4.0 of WooCommerce new menus and sections have been appearing that are not always necessary, and in fact often only serve to slow down the loading of your online store, fill your database with unnecessary information and, in short, fill your website with useless junk.

So, in my divine work to remove everything that WordPress doesn’t need, here is a guide to learn how to remove all those annoying elements that should never be in WooCommerce.

Note: Almost all the codes shown in this guide must be added to the end of the functions.php file of the active (child) theme or in a specialized plugin you create for customizations.

How to remove the marketing menu

If there is one annoying menu, it is the marketing menu, it is useless, except to “host” the coupon management, but what if you don’t use coupons? does it have to be there occupying all that place?

Of course not!

To remove that menu simply use this code:

add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' ); add_filter( 'woocommerce_admin_features', 'disable_features' ); function disable_features( $features ) { $marketing = array_search('marketing', $features); unset( $features[$marketing] ); return $features; }
Code language: PHP (php)

How to remove the Analytics menu and all new WooCommerce administration.

Ah, you don’t use the WooCommerce analytics pages at all? Why do you want them there taking up precious space and storing data for no purpose?

Go for it!

Just a small detail, the analytics menu is linked to the new WooCommerce admin interface so to remove that menu you have to remove all the new WooCommerce admin functionality (top bar, home, all analytics, etc.), so it’s your choice.

The code is as follows:

<?php /** * Plugin Name: Disable WooCommerce admin and Analytics * Description: A plugin to disable the new WooCommerce admin and Analytics. * Version: 1.0 */ add_filter( 'woocommerce_admin_disabled', '__return_true' );
Code language: HTML, XML (xml)

In this case you will see that it is not a code to add to the functions.php file, because it would not work. It is a plugin file, which you can download at this link and install it like any other plugin.

Note: If you are sure that you are not going to need all the new WooCommerce administration I recommend that, in addition to the above, you delete the following tables from the database of your installation:

  • wp_wc_admin_notes
  • wp_wc_wc_admin_note_actions
  • wp_wc_wc_category_lookup
  • wp_wc_wc_customer_lookup
  • wp_wc_wc_order_coupon_lookup
  • wp_wc_wc_order_product_lookup
  • wp_wc_wc_order_stats
  • wp_wc_wc_order_tax_lookup

How to remove the extensions menu

Another menu you may not use is the extensions menu.

The code that will save you from seeing it hanging around is this one:

/* Disable extensions menu WooCommerce */ add_action( 'admin_menu', 'wcbloat_remove_admin_addon_submenu', 999 ); function wcbloat_remove_admin_addon_submenu() { remove_submenu_page( 'woocommerce', 'wc-addons'); }
Code language: JavaScript (javascript)

And, while we’re at it, let’s get rid of the ads that suggest us from time to time to install this or that extension or to connect to WooCommerce.com, right?

This code is what you have to add:

add_filter( 'woocommerce_allow_marketplace_suggestions', '__return_false', 999 ); //Extension suggestions add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' ); //Connect to woocommerce.com
Code language: JavaScript (javascript)

Let’s see what have we done until now with all this.

How to remove WooCommerce desktop widget.

If you’re not one to go through the WordPress dashboard, why would you want a WooCommerce widget that has to do a lot of database queries to display your information?

Wouldn’t it be better to save the server that work and remove it?

The magic code for this is this:

/* Disable WooCommerce dashboard status widget */ add_action('wp_dashboard_setup', 'wcbloat_disable_woocommerce_status'); function wcbloat_disable_woocommerce_status() { remove_meta_box('woocommerce_dashboard_status', 'dashboard', 'normal'); }
Code language: JavaScript (javascript)

How to remove widgets from WooCommerce

I’m sure you already know that WooCommerce adds a good amount of widgets for you to use in your online store right?

Didn’t you know that? That’s because you don’t use them, so let’s remove them, you’ll save a lot more database consumption and both the administration and your online store will go faster.

The code:

/* Disable WooCommerce widgets */ add_action('widgets_init', 'wphelp_disable_widgets_woo', 99); function wphelp_disable_widgets_woo() { unregister_widget('WC_Widget_Products'); unregister_widget('WC_Widget_Product_Categories'); unregister_widget('WC_Widget_Product_Tag_Cloud'); unregister_widget('WC_Widget_Cart'); unregister_widget('WC_Widget_Layered_Nav'); unregister_widget('WC_Widget_Layered_Nav_Filters'); unregister_widget('WC_Widget_Price_Filter'); unregister_widget('WC_Widget_Product_Search'); unregister_widget('WC_Widget_Recently_Viewed'); unregister_widget('WC_Widget_Recent_Reviews'); unregister_widget('WC_Widget_Top_Rated_Products'); unregister_widget('WC_Widget_Rating_Filter'); }
Code language: JavaScript (javascript)

If you want to keep any of the widgets in the code simply delete the line or add two backslashes (//) at the beginning of the line.

How to remove WooCommerce cart fragmentation

If we get into the optimization part(WPO), there is a script that slows down any online store, and that is the refreshed_fragments.

This is a feature of WooCommerce that causes cart totals to refresh without page reloads.

Note: This code, active by default, slows down a lot the loading of all the pages of your online store, but after disabling it may not calculate well the changes in the mini-cart when adding or removing quantities or products, so always do a check after disabling it.

The code is this:

/* Disable cart fragments */ add_action('wp_enqueue_scripts', 'wphelp_disable_woo_cart_fragments', 99); function wphelp_disable_woo_cart_fragments() { if(function_exists('is_woocommerce')) { wp_dequeue_script('wc-cart-fragments'); } }
Code language: JavaScript (javascript)

How to remove styles and scripts from WooCommerce

Finally, another very common and recommended optimization is to disable all styles and scripts that WooCommerce automatically loads on all pages, relegating their loading only to the cart pages, where there are products and checkout.

The code is as follows:

/* Disable styles and scripts WooCommerce */ add_action('wp_enqueue_scripts', 'wphelp_disable_scripts_woocommerce', 99); function wphelp_disable_scripts_woocommerce() { if(function_exists('is_woocommerce')) { if(!is_woocommerce() && !is_cart() && !is_checkout() && !is_account_page() && !is_product() && !is_product_category() && !is_shop()) { //Styles wp_dequeue_style('woocommerce-general'); wp_dequeue_style('woocommerce-layout'); wp_dequeue_style('woocommerce-smallscreen'); wp_dequeue_style('woocommerce_frontend_styles'); wp_dequeue_style('woocommerce_fancybox_styles'); wp_dequeue_style('woocommerce_chosen_styles'); wp_dequeue_style('woocommerce_prettyPhoto_css'); //Scripts wp_dequeue_script('wc_price_slider'); wp_dequeue_script('wc-single-product'); wp_dequeue_script('wc-add-to-cart'); wp_dequeue_script('wc-checkout'); wp_dequeue_script('wc-add-to-cart-variation'); wp_dequeue_script('wc-single-product'); wp_dequeue_script('wc-cart'); wp_dequeue_script('wc-chosen'); wp_dequeue_script('woocommerce'); wp_dequeue_script('prettyPhoto'); wp_dequeue_script('prettyPhoto-init'); wp_dequeue_script('jquery-blockui'); wp_dequeue_script('jquery-placeholder'); wp_dequeue_script('fancybox'); wp_dequeue_script('jqueryui'); } } }
Code language: JavaScript (javascript)

The result will be especially noticeable on those pages or posts where WooCommerce styles and scripts are not needed, improving their performance and loading times.

Extra: How to disable the password strength meter.

Well yes, let’s finish with an extra, because it turns out that the script needed to perform the automatic password strength check of WooCommerce, and also WordPress, is really heavy.

It adds no less than 400 Kb of overhead to all the pages where it is not necessary, to all of them.

The code to disable it is this:

/* Disable password strength meter */ add_action( 'wp_print_scripts', 'wphelp_disable_password_strength_meter', 10 ); function wphelp_disable_password_strength_meter() { wp_dequeue_script( 'wc-password-strength-meter' ); }
Code language: JavaScript (javascript)

Can’t all that be done with plugins?

Well, I’ve already given you a plugin(see above) but yes, there is also a plugin that will help you clean up all those things you don’t like about WooCommerce.

It’s called Disable WooCommerce Bloat, and once installed and active it will allow you to enable or disable all those annoying WooCommerce screens and junk, at the click of a button.

Well, and that’s it!

We have removed a lot of things that you may have left over in WooCommerce, and also we have optimized the load of your online store, what more can you ask for?

Any questions you know, tell me below, in the comments.

Click to rate this post!
[Total: 0 Average: 0]

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top Skip to content