Free Ways to Optimize OpenCart Speed
Site load speed affects conversion and search rankings. If you think optimizing your site's load speed on your own is very difficult or impossible, then this article is for you. We will look at OpenCa…
Site load speed affects conversion and search rankings. If you think optimizing your site's load speed on your own is very difficult or impossible, then this article is for you. We will look at OpenCart optimization methods that do not require buying additional modules or paying for services.
We also recommend checking out the Top 10 OpenCart Modules that will help you grow organic traffic.
Main stages of OpenCart load speed optimization
Twig cache
OpenCart has a built-in template cache. It must be enabled in the admin panel. This reduces the number of computations when generating pages. So, open the admin Dashboard, use the gear icon button to access additional settings, and enable Theme cache.
Static file cache
CSS, JS, and images must be cached at the server level. To do this, it is enough to set rules in the Apache or Nginx configuration with a long expires or cache-control. Usually, you can enable static file caching in your hosting panel. If you don't have such an option — add caching rules to the .htaccess file (in your site's root):
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/webp "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
Replacing external resources with internal ones
Upload to your server all external scripts, styles, and fonts from CDNs. This will reduce the number of DNS lookups and speed up loading. Pay particular attention to Google Fonts, jQuery, Bootstrap, and Font Awesome from CDNs. Try to make your site load only its own resources, without relying on external servers. Keep scripts and fonts on your own server and serve them from there.
Deferring iframes
If you use iframes (YouTube video, Google Maps), add the loading="lazy" attribute or implement deferred loading via JavaScript with a 2-3 second delay after the main content has loaded.
Deferred script loading
Add the defer attribute to Contact via Telegram Contact via Telegram