Performance and layout-stability work on a live Magento 2 shop: one jQuery instead of two, no layout shift on product pages, and a homepage carousel cut from 23.4 MB to 646 KB.
The problem
The shop's Magento store was slow on mobile and jumped around while loading. Local Lighthouse runs before any change put the mobile home page at 45 and the category page at 38. Product pages shifted by 0.34 CLS on mobile. About half of all cold loads threw script errors, so the gallery, sticky header and filters sometimes never started.
The store takes real orders, so every change had to be safe to roll back.
What I built
A set of small, measured releases to the live store over about a week.
- Found that the theme loaded its own jQuery after RequireJS had already fetched a second copy. Plugins attached to the wrong one. Moving one script tag fixed the errors, and two CSS fixes made the newly working scripts cheap to run.
- Removed layout shift on product and category pages: reserved space for the gallery and logo, fallback fonts with matching metrics, and a sidebar moved with
transforminstead oftop. - Re-encoded six homepage carousel images. A desktop visit that scrolled the carousel used to download 24.1 MB.
- Gated reCAPTCHA behind cookie consent, subset the icon fonts, and loaded mega-menu images on demand.
How it works
I kept two local copies of the store in Docker, the original and the modified one, with outbound network, cron and mail blocked. Changes went to a staging copy first, then to the live host. Every release had a dry run of deploy and rollback, a backup checked by SHA-256, a Varnish purge and a scripted check of 36 live URLs afterwards.
Measurement used medians of several runs and main-thread traces. When a candidate made one number better and another worse, it did not ship. A JavaScript bundling trial was tested on staging and left off for that reason.
Outcome
After the last release there were no script errors in 26 cold loads, one jQuery on every page, and product-page CLS on mobile of 0.000. The homepage carousel went from 23.4 MB to 646 KB. Google PageSpeed Insights mobile medians were about 80 for the home page, 79 for category pages and 68 for product pages. The early baselines came from local Lighthouse, so the two sets of scores show the direction and are not a controlled comparison.
Need something like this built? contact@akhilsingh.in