How to optimize the WordPress home page when using WooCommerce

Your home page is your site visitors first impression of your site so you'll want it to load as fast as possible. You can reduce the load time of your WordPress home page by removing scripts that are not needed. This article shows you how to use the A2 Optimized WP plugin to remove a WooCommerce script you may not need.

Extra javascript added by WooCommerce

WooCommerce adds a number of additional scripts to every page on your site. One of these scripts, cart-fragments.min.js, makes an AJAX call to gather information about your cart to display on the page. The AJAX call can take a substantial amount of time to complete. If your homepage does not have any elements that rely on WooCommerce, then the time spent gathering this information is wasted.

Removing extra javascript with A2 Optimized WP

The A2 Optimized WP plugin combines custom A2 Hosting settings and functionality from third-party plugins to provide speed and security optimizations for your WordPress site. One of these optimizations uses a process called dequeuing to prevent the cart-fragments script from running on your home page. Follow these instructions to install the plugin and make the setting to optimize your home page:

  1. Log in to WordPress as the administrator.
  2. A2 Optimized WP may already be installed. Check the left side menu in the adminstrator for the A2 Optimized menu. If A2 Optimized WP is already installed, go to step 7.
  3. In the left side menu, click Plugins, and then click Add New.
  4. In the Search Plugins text box, type a2 optimized and then press Enter.
  5. Locate the A2 Optimized WP plugin, and then click Install Now. WordPress installs the plugin.
  6. After the plugin is installed, click Activate Plugin. You are now ready to configure the plugin.
  7. In the left side menu, click A2 Optimized.
  8. Click the Optimization Status tab to select it.
  9. Scroll down the page until the Dequeue WooCommerce Cart Fragments AJAX calls option is visible.
  10. Click Enable.

The cart-fragments.min.js script is now disabled on the home page. Other pages in the site are not affected.

A2 Optimized WP includes many optimizations and security settings. You can read more about them in this article.

Get WooCommerce Hosting

Article Details

Other Articles in This Category

Show More

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.