Most WooCommerce performance problems come from two sources: uncached PHP/AJAX requests hitting the origin on every page view, and visual page builders loading bloated DOM trees and scripts on every storefront route.
1. Stop wc-cart-fragments from hammering PHP
By default, WooCommerce dispatches uncached ?wc-ajax=get_refreshed_fragments requests even for visitors with empty carts, bypassing page caches and exhausting PHP workers. On Medical Pharm (etarskaikozmetickaulja.rs), conditionally dequeuing cart fragments for empty carts eliminated 10,000+ uncached PHP hits per hour while keeping reactive cart state synced via lightweight Alpine.js stores.
2. Replace page builders with a zero-bloat Vite + Alpine.js theme
Instead of stacking Elementor or commercial multi-purpose themes with dozens of plugins, building a clean classic theme powered by Vite 5, Tailwind CSS, and Alpine.js keeps asset payloads minimal and interaction latency predictable across mobile devices.
3. Optimize database, Heartbeat, and custom business logic
- Migrate order tables to WooCommerce HPOS to avoid slow wp_postmeta joins.
- Throttle WordPress Heartbeat to 60 seconds and configure 1-year immutable browser caching on versioned Vite assets.
- Use O(1) in-memory WordPress Transients hash maps for checkout risk checks instead of scanning historical orders in MySQL.
- Keep operational utilities—like pure-PHP procurement PDF generation under 4MB RAM—free of heavy third-party dependencies.
| Storefront Layer | Legacy Bottleneck Pattern | Engineered Solution & Observed Outcome |
|---|---|---|
| Cart Hydration | Uncached ?wc-ajax=get_refreshed_fragments on empty carts | Conditional dequeue + Alpine.js stores (10,000+ PHP hits/hr saved) |
| Theme Layer | Visual page builders & stacked UI plugins | Custom Vite 5 + Tailwind CSS + Alpine.js (<600ms real-user TTFB) |
| Order Storage | Shared wp_posts / wp_postmeta table locks | WooCommerce HPOS normalized custom order tables |
| Checkout Screening | Per-checkout MySQL scans on historical orders | O(1) WordPress Transients hash maps with zero table scans |
Measured architecture outcome
Production result on LiteSpeed shared hosting (etarskaikozmetickaulja.rs): <600ms real-user TTFB and 10,000+ uncached PHP executions eliminated per hour.