Remove WooCommerce bloat without plugin

Last edited:
October 31, 2023
Reading time:
8 mins

/

Blog

/

WooCommerce

/

Remove WooCommerce bloat ...

đź’ˇWe may earn a commision if you subscribe to a service from a link on this page.

WooCommerce is undoubtedly a powerful and widely-used e-commerce plugin for WordPress, providing robust features to create online stores. However, as your store grows and evolves, you might notice that WooCommerce adds additional features and functionalities that you may not need. This leads to increased resource consumption, slower website performance, and even potential security risks. In this article, we will delve into the reasons why removing WooCommerce bloat is beneficial for your online store, the advantages you can gain, and the various techniques to achieve a streamlined WooCommerce setup. We will reveal how to apply the most crucial optimizations that are implemented by various pro optimization plugins in WordPress market, for free.

The Need to Remove WooCommerce Bloat

As WooCommerce evolves, its codebase grows, and additional features are added to accommodate a wide range of users. These features, while useful to some, might not be essential for every store owner. By removing the unnecessary bloat, you can declutter your WooCommerce installation and ensure that your website runs optimally, providing a better experience to your customers.

Benefits of Removing WooCommerce Bloat

Enhanced Website Performance

One of the primary advantages of removing WooCommerce bloat is a significant boost in website performance. Bloated code and unnecessary features slow down page loading times, leading to a subpar user experience. By streamlining your WooCommerce installation, you can reduce server requests, optimize database queries, and minimize HTTP requests, resulting in faster page loads and improved performance.

Improved Security

Removing unnecessary plugins and features minimizes the attack surface for potential security threats. Often, unused or outdated plugins can become vulnerabilities, making your store susceptible to attacks. By removing the bloat, you can reduce potential security risks and protect your store and customer data.

Simplified User Experience

A cluttered and complex interface can be overwhelming for users and make navigation challenging. By removing unnecessary elements, you can create a more straightforward and intuitive user experience for your customers. This, in turn, can lead to higher customer satisfaction and increased conversion rates.

Efficient Resource Management

Reducing the load on your server and database by removing bloat can help you optimize resource consumption. This leads to cost savings, especially if you are using a hosting plan with limited resources. Efficient resource management ensures your store remains performant even during high traffic periods.

Techniques to Remove WooCommerce Bloat

Disable Unused WooCommerce Modules

WooCommerce comes with various modules that add extra functionality to your store. However, you may not need all of them. By disabling unused modules, you can reduce the number of unnecessary scripts and styles loaded on your website, resulting in faster page loading times.

Disable Woocommerce admin

Disabling WooCommerce admin is a practice employed by website administrators to optimize the performance of their WooCommerce-powered online stores. While the WooCommerce admin dashboard provides a comprehensive range of features and insights for managing products, orders, and customers, it can also consume significant server resources, leading to slower loading times and decreased website performance. In cases where real-time data monitoring is not critical (after all, you have Google Analytics and Woocommerce Reports), disabling the WooCommerce admin can alleviate server strain, resulting in faster page loads and enhanced user experience. By disabling the admin when it is not actively needed, website owners can ensure that server resources are efficiently utilized, leading to improved website responsiveness, reduced downtime, and an overall smoother online shopping experience for their customers.

add_filter( 'woocommerce_admin_disabled', '__return_true' );

Disable Marketing Tab

Don’t worry, your Coupon Tab will be automatically transferred below Woocommerce tab, in it’s old position.

add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' );
add_filter( 'woocommerce_admin_features', 'marketing_disable_features' );
function marketing_disable_features( $features ) {
$marketing = array_search('marketing', $features);
unset( $features[$marketing] );
return $features;
}

Disable helper connection to Woocommerce.com

If you don’t mind missing suggestions for updates and support, feel free to remove admin notices:

add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' );

Disable Password Meter

In order for this to work properly, make sure you implement the “Account Login/Register” functionality as a link and not as a pop up. If you choose to have a pop up with Email and Password form in header for example, then this script should be better loaded everywhere. However we strongly advice you to use a link for your account page in any Account items in your header.

add_action('wp_print_scripts', 'disable_password_strength_meter_wpr', 100);
function disable_password_strength_meter_wpr() {
global $wp;
$page_check = isset($wp->query_vars['lost-password']) || (isset($_GET['action']) && $_GET['action'] === 'lostpassword') || is_page('lost_password');
$woo_check = (class_exists('WooCommerce') && (is_account_page() || is_checkout()));
if(!$page_check && !$woo_check) {
if(wp_script_is('zxcvbn-async', 'enqueued')) {
wp_dequeue_script('zxcvbn-async');
wp_deregister_script('zxcvbn-async');
}
if(wp_script_is('password-strength-meter', 'enqueued')) {
wp_dequeue_script('password-strength-meter');
wp_deregister_script('password-strength-meter');
}
if(wp_script_is('wc-password-strength-meter', 'enqueued')) {
wp_dequeue_script('wc-password-strength-meter');
wp_deregister_script('wc-password-strength-meter');
}
}
}

Disable WooCommerce Status Meta Box

add_action('wp_dashboard_setup', 'disable_woocommerce_status_wpr');
function disable_woocommerce_status_wpr() {
remove_meta_box('woocommerce_dashboard_status', 'dashboard', 'normal');
}

Disable WooCommerce Marketplace Suggestions

We are sure you can live without Marketplace suggestions. If you agree, you can remove them with the following filter:

add_filter( 'woocommerce_allow_marketplace_suggestions', '__return_false', 999 );

Disable Extensions submenu

You can remove the extensions submenu using the following action:

add_action( 'admin_menu', 'remove_addons_submenu_wpr', 999 );
function remove_addons_submenu_wpr() {
remove_submenu_page( 'woocommerce', 'wc-addons');
remove_submenu_page( 'woocommerce', 'wc-addons&section=helper');
}

Disable WooCommerce Widgets

Probably you don’t use all Woocommerce widgets. Make sure you disable those you do not use (below is a list of all the widgets, choose only those you want to unregister):

add_action('widgets_init', 'disable_woocommerce_widgets', 99);
function wcbloat_disable_woocommerce_widgets() {
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');
}

Remove WordPress specific Bloat

We have a whole article with instructions on how to disable WordPress bloat and remove features that may not be important to your setup. Here’s a list with the most important ones:

add_action( 'init', 'remove_wpbloat_wpr' );
function remove_wpbloat_wpr() {
/* Remove RSD link */
remove_action('wp_head', 'rsd_link');
/* Remove WordPress Generator */
remove_action( 'wp_head', 'wp_generator' ) ;
/* Disable XMLRCP */
add_filter('xmlrpc_enabled', '__return_false');
add_filter( 'pre_update_option_enable_xmlrpc', '__return_false' ); 
add_filter( 'pre_option_enable_xmlrpc', '__return_zero' );
/* Remove WLW Manifest link */
remove_action('wp_head', 'wlwmanifest_link');
/* Remove header shortlink */
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
/* Remove feed links */
remove_action('wp_head','feed_links_extra',3);
remove_action('wp_head','feed_links',2);
/* Remove emoji script */
remove_action('wp_head','print_emoji_detection_script',7);
remove_action('wp_print_styles','print_emoji_styles');
/* Remove REST header link (does not disable REST, only hides link */
remove_action('wp_head', 'rest_output_link_wp_head');
/* Disable template redirect */
remove_action( 'template_redirect', 'rest_output_link_header', 11);
/* Disable Woocommerce inline styles */
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
/* Disable WordPress svg styles */
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
}

Manage WP Heartbeat

Setting WordPress heartbeat API to higher frequency is an easy way to save some server resources without any important drawbacks:

function wp_heartbeat_settings_wpr( $settings ) {
// Anything between 15-120 
$settings['interval'] = 119; 
return $settings;
}
add_filter( 'heartbeat_settings', 'wp_heartbeat_settings_wpr' );

Remove Dashboard welcome cards

If you don’t find the welcome cards very useful, you can completely remove them using the following function:

function remove_dashboard_cards() {
// Remove Welcome panel
remove_action( 'welcome_panel', 'wp_welcome_panel' );
// Remove the rest of the dashboard widgets
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal'); 
}
add_action( 'wp_dashboard_setup', 'remove_dashboard_cards' );

Remove Unwanted CSS and JavaScript

WooCommerce loads various CSS and JavaScript files to cater to its extensive features. Often, these files include styles and scripts that you may not use in your theme. By removing unwanted CSS and JavaScript, you can cut down on the size of your page and improve load times.

By default, two commonly not used styles are WP Block library and Classic Theme Styles. We advice you to check our article on how to discover and remove unnecessary scripts and styles, so you can identify any scripts that you can also remove from certain pages. An example for removing the default CSS styles and a specific script from your homepage (make sure you uncomment the relative lines and replace ‘my-script’ with your script name) is as follows:

function remove_default_stylesheets_wpr() {
wp_dequeue_style( 'wp-block-library' );
wp_deregister_style( 'wp-block-library' );
wp_dequeue_style( 'classic-theme-styles' );
wp_deregister_style( 'classic-theme-styles' );
// if ( is_page( 'homepage' ) ) {
// wp_dequeue_script( 'my-script');
// wp_deregister_script( 'my-script');
// }
}
add_action( 'wp_enqueue_scripts', 'remove_default_stylesheets_wpr', 999 );

Make tests, take backups and continue unbloating Woocommerce

In conclusion, while we have covered some of the most crucial steps to remove WooCommerce bloat and optimize your online store’s performance, it’s essential to remember that every website is unique. Before implementing any changes, thoroughly check the compatibility and impact on your specific setup. Always take a backup of your website before making significant modifications. This precautionary measure ensures that you can easily revert to the previous version in case of any unexpected issues. Additionally, having access to your web hosting control panel, like cPanel or similar tools, can be a lifesaver if something goes awry with your code. It allows you to quickly access and fix any issues that may arise.

As you continue on your journey of optimizing your WooCommerce store, don’t forget to stay updated with the latest best practices and techniques in the field of website performance. Regularly review your website’s performance metrics and be open to making further improvements when needed. In the world of web development, continuous learning and refinement are the keys to success. So, happy coding!

Leave a Reply

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