Optimizing WooCommerce for Speed: 5 Techniques You Can’t Ignore
Shreya Bose, Technical Content Writer at BrowserStack - June 25, 2020
When it comes to eCommerce platforms, WooCommerce is preferred for a good reason. It is quite easy to set up a WooCommerce store. Simply purchase a domain and add the WooCommerce plugin to the WordPress website. Just like that, the online store is open for business!
As more WooCommerce sites compete in the digital landscape, it is important for each site to offer the best possible user experience. Tools like personalization, real-time inventory, live chat go a long way in giving users what they want and keep them coming back. However, there is no feature or tool that can make up for a basic flaw – a slow website.
This article discusses a few of these steps, so that website owners do not lose out on traffic, revenue, or credibility for this reason.
How to speed up WooCommerce?
1. Increase the WordPress Memory Limit
By default, WordPress memory is set to 32 MB. At some point, this limit will be exceeded and the user will receive an error message that notifies them of the same. Now, there are two ways to address this issue: the user does it themselves or contacts the hosting company.
In order to configure WordPress memory themselves, users can use the following steps:
Edit the wp-config.php file
- Open wp-config.php, located by default in the root WordPress directory
- Locate the following line near the end of the file: /* That’s all, stop editing! Happy blogging. */
- Just above that line, add: define(‘WP_MEMORY_LIMIT’, ‘256M’)
- Save changes
Edit the PHP.ini file
- If the user has access to their PHP.ini file, change the line in PHP.ini
- If the line shows 64M try 256M: memory_limit = 256M
The maximum amount of memory a script may consume is 64MB.
Edit the .htaccess file
- If the user does not have access to PHP.ini they can try adding the following line to an .htaccess file: php_value memory_limit 256M
2. Optimize the WooCommerce Website Images
Being visual creatures, people are drawn to websites that are visually appealing. Images are an important part of this appeal. However, using non-optimized images can adversely affect website performance by slowing it down. Optimizing images is an easy and effective way to speed up WooCommerce sites.
Large image files create loading delays on the website UX. Slow WooCommerce sites can lead to the website being downranked in search engines in SERP.
Combat this situation by using image compression plugins such as WP-Smush.it, EWWW Image Optimizer, or Hammy. They reduce the size of images and optimize them on WordPress without adversely affecting image quality. This is required to make WooCommerce faster.
3. Use a high-quality hosting service
A hosting service enables website owners to use a host server to store website content – media and other relevant files. The hosting service is the foundation of the website as it handles all traffic and data. Thus, a low-quality hosting service will damage WooCommerce website performance, especially traffic, products or offers, as the number of webpages increases. Always choose a fast and robust hosting service with the following qualities:
- 24/7 technical support to resolve issues and answer questions
- High-end cloud infrastructure
- Flexible in its ability to adapt as a WooCommerce store grows
- Data centers across the world
- High uptime rate so that the website is never down
- Provides an SSD based solution
- A server geographically located close to the website audience, thus providing fast response times
4. Disable AJAX Cart Fragments in WooCommerce
AJAX Cart Fragments is a feature in WooCommerce. It is a script that uses Admin-Ajax to automatically update the customer’s shopping cart total without needing to refresh the page. This is especially effective when it comes to generating instant feedback to shoppers so that they know that the right items have been added to their carts.
Despite its efficacy, this function can slow down website speed. It may even interrupt caching on pages that don’t actually need details of the cart. If there occurs a high number of AJAX requests on a WooCommerce site, disabling AJAX Cart Fragments will help to boost website speed and stability.
Fix this issue with the following: wc-ajax=get_refreshed_fragments. It is also possible to use the Disable Cart Fragments plugin which automatically disables the AJAX cart fragments feature in WooCommerce. However, while doing this, remember to redirect customers to the cart page when they need to verify the information. Otherwise, the disabling will disrupt the user experience.
5. Use a cache plugin
By caching, a version of the WooCommerce store’s resource is stored on the visitor’s device, thus allowing the site to load faster. This occurs because caching reduces the amount of data sent between the visitor’s browsers, the site database, and the server.
Pay attention to the following:
- Server Caching: Since the server generates the web page, server caching enables it to remember parts of the web page so that the whole page does not need to be generated from scratch every time.
- Browser Caching: This helps the browser remember what a web page looks like so that it does not need to spend time exchanging data with the server. This is useful for visitors accessing multiple pages because static files (stylesheets, JavaScript files) can be stored by the browser.
Read More: How to test Javascript in browsers
A few recommended WooCommerce caching plugins are:
- Breeze WordPress cache plugin: Has file exclusion feature, combines and minifies HTML, CSS and JS files, and minimizes the file size and download time through Gzip compression.
- WP Rocket: Has cache preloading, browser caching, GZIP compression, HTML, CSS & JavaScript minification and concatenation. It also carries a lazy image loading feature that loads images only when the user scrolls down the page.
- W3 Total Cache: Has a devoted settings page for every caching type – database caching, browser caching, page caching, object caching, etc. It provides exceptional levels of customizability.
However, when using plugins, exclude the cart, the user accounts, and checkout pages from the cache. These pages must be dynamic as they contain information relevant only to individual customers.
Testing WooCommerce website speed
Instead of losing users by introducing them to a slow WooCommerce website, test the website loading speed. There are multiple tools that allow website speed testing, but few of them actually test a site on real browsers and devices.
BrowserStack’s website speed test tool SpeedLab is free, and verifies site speed on real browsers, devices and operating systems. Users simply have to enter the URL and click Start. The tool returns a detailed report mentioning how the website performs on multiple devices and browsers and real-time.
Use SpeedLab to test a website before and after using the WooCommerce performance optimization methods outlined in this article. WooCommerce speed optimization is one of the central aspects of building an eCommerce website that keeps users happy, attracts more visitors and grows consistently.