0%
Initializing Identity
WooCommerce Performance Optimization — From 8s Load to Under 2s
WordPress

WooCommerce Performance Optimization — From 8s Load to Under 2s

10 décembre 202510 min read
A
Ashraf Chihab
Full Stack Developer

I inherited a WooCommerce store that took 8.3 seconds to load on mobile. Three weeks later it was under 1.8s. Here's exactly what I did.

Audit First

Before touching anything, measure. Use GTmetrix or PageSpeed Insights. Note your baseline LCP, TBT, and CLS scores. You can't improve what you don't measure.

1. Hosting Upgrade

Shared cPanel hosting is the single biggest bottleneck for most WooCommerce stores. Moving to a VPS with LiteSpeed or Nginx + PHP-FPM 8.2 cut our TTFB from 1.8s to 180ms alone.

If you can't migrate, at minimum enable PHP 8.2 in cPanel — it's 30–40% faster than PHP 7.4.

2. Caching with LiteSpeed Cache

LiteSpeed Cache is free and the most effective WordPress cache plugin:

LiteSpeed Cache → Cache → Enable Cache: ON
LiteSpeed Cache → Page Optimization → CSS Minify: ON
LiteSpeed Cache → Page Optimization → JS Defer: ON
LiteSpeed Cache → Image Optimization → Lazy Load Images: ON

For Nginx servers, use WP Rocket instead — worth every euro.

3. Database Optimization

WooCommerce bloats the `wp_options` table with autoloaded data. Clean it:

-- Find heavy autoloaded options
SELECT option_name, LENGTH(option_value) as size
FROM wp_options
WHERE autoload = 'yes'
ORDER BY size DESC
LIMIT 20;

-- Delete transients
DELETE FROM wp_options
WHERE option_name LIKE '%_transient_%';

Also add indexes to the `wp_postmeta` table if you have 10k+ products:

ALTER TABLE wp_postmeta ADD INDEX meta_value_idx (meta_value(20));

4. Image Optimization

Install ShortPixel or Imagify and compress all images. Enable WebP conversion. For product images, set WooCommerce thumbnail sizes conservatively:

// functions.php
add_filter('woocommerce_get_image_size_gallery_thumbnail', function($size) {
    return ['width' => 150, 'height' => 150, 'crop' => 1];
});

5. Reduce Plugin Count

Every active plugin adds PHP execution time. Audit your plugins — we removed 11 and replaced them with 3 lighter alternatives. Use Query Monitor to find slow hooks.

6. CDN Setup

Cloudflare free tier is sufficient for most stores. Enable: - Auto Minify (HTML, CSS, JS) - Brotli compression - Browser Cache TTL: 1 year - Rocket Loader: test carefully (breaks some checkout JS)

7. WooCommerce-Specific Tweaks

// Disable cart fragments AJAX on non-cart pages
add_action('wp_enqueue_scripts', function() {
    if (!is_cart() && !is_checkout()) {
        wp_dequeue_script('wc-cart-fragments');
    }
}, 11);

// Disable WooCommerce status widget
add_filter('woocommerce_prevent_automatic_wizard_redirect', '__return_true');

Results

| Metric | Before | After | |--------|--------|-------| | LCP | 6.8s | 1.4s | | TBT | 1200ms | 180ms | | PageSpeed Mobile | 31 | 84 | | PageSpeed Desktop | 58 | 96 |

Conclusion

WooCommerce performance is 80% hosting and caching, 20% everything else. Fix those two first before chasing marginal gains elsewhere.

Tags :WooCommerceWordPressPerformanceSEOPHPLiteSpeed
Partager :
Chat on WhatsApp