Skip to content

How to clear the PrestaShop cache, from the admin and by hand

· The AYT team · 5 min read

Woman in sunglasses holding many shopping bags

To clear the PrestaShop cache from the admin, go to Advanced Parameters → Performance and click the "Clear cache" button at the top of the page. If the back office won't open, clear the cache by hand: delete the contents of the var/cache/prod and var/cache/dev folders over FTP or in the File Manager. With console access, php bin/console cache:clear empties the same folder. The methods are the same in PrestaShop 1.7, 8 and 9; only on 1.7.0–1.7.3 the cache sits in app/cache instead of var/cache.

The caches PrestaShop has

"The PrestaShop cache" is really several things, stored in different places:

Cache What it holds Where it lives
Application cache Symfony configuration, routes, the class list var/cache/prod (or dev in debug mode)
Smarty the theme's templates compiled to PHP var/cache/prod/smarty
CCC (combined CSS and JavaScript) merged and compressed CSS and JS files themes/themename/assets/cache
Object cache (optional) database results Memcached or APC, if you turned it on
Caches outside PrestaShop whole pages, images the web server, the CDN, the browser

The "Clear cache" button clears the first three. The cache:clear command only clears what sits in var/cache (the application and Smarty), so you delete the CCC files separately. Caches outside PrestaShop are cleared separately.

There is also a cache/ folder in the shop's root, but the cache you clear from 1.7.4 on is the one in var/cache.

Method 1: from the back office

  1. Log in to the back office.
  2. Go to Advanced Parameters → Performance.
  3. Click "Clear cache", at the top of the page.
  4. Open the shop in a private window and check your change.

The first shop page after clearing is slower, because PrestaShop rebuilds the cache.

Method 2: by hand, in the File Manager or over FTP

Use this method when the back office returns a 500 error, when the button has no effect, or after a move.

  1. Open the shop's folder in the File Manager or an FTP client.
  2. Go into var/cache/.
  3. Delete everything inside the prod folder and the dev folder. Leave the var/cache/prod and var/cache/dev folders in place, empty.
  4. If you changed CSS or JavaScript and use CCC, also delete the files in themes/themename/assets/cache/.
  5. Reload the shop, then the back office.

Don't delete other folders in var/, such as var/logs: they aren't cache, and you need the logs when you're chasing an error.

If the prod folder holds tens of thousands of files, deleting over FTP can take a long time. A File Manager in your hosting panel is usually faster, because it deletes directly on the server.

Method 3: from the console

From the shop's folder:

php bin/console cache:clear

php bin/console cache:clear --no-warmup clears the cache without rebuilding it right away; PrestaShop rebuilds it on the first visit. On hosting with little memory, the no-warmup version finishes more reliably.

When to clear the cache

It's worth clearing after:

  • installing, updating or uninstalling a module;
  • theme changes (.tpl templates, CSS, JavaScript);
  • changes to translations or override files;
  • a move to another server or domain;
  • a PHP version change.

There's no point clearing it daily "just in case". Every clear makes the first pages slower, and on a shop with traffic visitors notice.

The cache settings under Performance

The same page, Advanced Parameters → Performance, has the settings that decide how often the cache is rebuilt:

  • Smarty, "Template compilation": on a live shop, choose "Never recompile template files" or "Recompile templates if the files have been updated". "Force compilation" recompiles on every page; use it only while you work on the theme.
  • Smarty, "Cache": keep it on in production. Turn it off only while you debug a theme or a module.
  • CCC: "Smart cache for CSS" is safe to turn on. "Smart cache for JavaScript" can break some modules, so test before leaving it on.

With "Never recompile template files", changes to theme files don't show until you clear the cache. That's usually the explanation for "I changed the template and nothing shows".

If a 500 error appears after clearing

It happens when the cache rebuild stops halfway: memory too low, execution time exceeded or a folder without write permission. Empty var/cache/prod and var/cache/dev by hand again, then follow the steps in the article on the PrestaShop 500 error.

Frequently asked questions

Does clearing the cache delete products, orders or customers?

No. The cache only holds files PrestaShop can rebuild at any time from the database and the theme files. Products, orders and customers live in the database and aren't touched.

I cleared the cache and still see the old version. Why?

Most often the page comes from another cache: your browser's (try a private window), a CDN such as Cloudflare, or a server page cache. Clear that one too.

The cache on AYT hosting

On AYT, for PrestaShop 8 shops, the PrestaShop Toolkit has an "Empty the caches" button under Settings, which runs cache:clear without you needing SSH. There you also turn on or off a 15-minute page cache in nginx, which never applies to the cart, checkout, logged-in customers or admin pages. The same Settings page has the template compilation options, the Smarty cache and CSS and JavaScript combining. On the Commands page you run cache:clear directly, and you can also empty var/cache in the File Manager.

File Manager with a site's files

See what else the toolkit does on the features page and the plans on the hosting page.

More articles

All articles