Cleaning your PrestaShop database is essential

PrestaShop module to clean your store from unnecessary data

You may not be aware of it, but Prestashop quickly accumulates a lot of useless data over the days.

This is a good thing because it allows you to have access to a lot of information but it can also cause malfunctions on your store if you don't clean this data regularly.

When I talk about useless data, it is mostly data that may be needed for a period of time but which, after that period, become obsolete and must be deleted.

The data mainly concerned by this cleaning are those related to visit statistics. Necessary to monitor the proper functioning of your store, they quickly become redundant with the analytics tools that you use and therefore quickly clutter your database and can reduce the performance of your store.

As part of my maintenance contracts, I am regularly required to perform this task on my clients' sites.

A recurring and tedious task, which led me to develop a powerful and practical module to handle the most common tasks.

Presentation of my module

This module will allow you to carry out manually or automatically with the help of cron tasks scenarios concerning data that can be deleted.

It consists of three main sections.

Clean up the database

  • Statistical data
  • Email Log
  • Logbook
  • Search log

All of this data can be deleted without great risk since it only concerns data from the past to allow you to analyze the proper functioning of your store or to understand your visitors. A retention period allows you to limit the retention of this information to several days.

With my clients, I delete all the tables in this section, keeping the last 90 days in order to have a possible analysis of the statistics in Prestashop, statistics that have been improved lately.

Clean up clients

  • Abandoned carts
  • Guests without address
  • Guests without orders
  • Clients without address
  • Customers without orders
  • Customer discussion thread

These scenarios are more complex and come with a specific explanation to help you decide whether or not to keep the data.

Here, I automatically delete only the first three scenarios, even if I strongly advise against leaving the option of PrestaShop allowing to order as a "guest" without creating a customer account, some customers want to keep this option which can cause a creation of multiple accounts of recurring customers.

Clean the catalog

  • Expired specific prices
  • Expired vouchers
  • Unused feature values
  • Unused custom feature values
  • Empty characteristics
  • Unused attribute values
  • Empty attribute groups

If some scenarios appear obvious when choosing their deletion (expired specific prices, expired vouchers), it will still be necessary to be careful on the others even if I propose them these can have a negative influence on the use of your store, so take the time to read each explanation to avoid making any mistake.

Cron tasks

The last section, and not the least, allows access to the cron tasks corresponding to each group of scenarios.

You can individually select each scenario to be integrated into its cron task and thus regularly schedule the application of these cron tasks to automatically clean up the data in your store.

The development that I set up allows a very interesting thing by offering the possibility to modify the programmed scenarios without having to intervene on the programming of your cron tasks.

You just have to check or uncheck a scenario so that the change is taken into account directly during the next programming of the associated cron task.


This module intervenes directly on the data stored in the database, so any action performed cannot be undone.

It is therefore essential to take your time to analyze what you want to do and apply the right scenarios according to the use of your store.

You are the owner of your data and therefore responsible for what you do with it. I cannot be held responsible in case of error in the handling of the module.

Photo gallery

Future of the module

This module will have to evolve constantly between the users' requests and my support needs with my customers.

I've already had a couple of additional ideas from talking with the users of my new third-party space, La Caale.

And as often, my customers in maintenance contract will be the first to benefit from it, then the customers having bought on my site will be informed by email as soon as the new version is available and lastly, the customers having ordered on Addons because of the validation delay imposed, rightly, by Addons at the time of the launching of the module.