Empty Cart Button — Complete Guide
Install, configure and use the "Empty cart" button on the cart page for PrestaShop 8 and 9.
Overview
The Empty Cart Button module (dfclearcart) adds an “Empty cart” button to your store’s cart page that clears the entire cart in a single click: all products, their combinations and customizations, plus any discount vouchers applied. The module is fully self-contained: no Composer dependency, no SQL table added.
The button is injected with JavaScript via an always-present hook, then placed inside the cart block. It therefore appears even on custom themes that do not fire the usual cart page display hooks.
Compatibility
- PrestaShop 8.0 to 9.x
- Single-store and multistore
- 5 languages: FR, EN, ES, DE, IT
- Classic theme and custom themes
- No dependency (neither Composer nor framework)
Installation
- In the back office, open Modules > Module Manager.
- Click Upload a module and select the
dfclearcart.zipfile. - Once installed, click Configure.
On installation, the module registers its hooks (asset loading on the front office and the button on the cart page) and creates its default settings: button enabled, confirmation enabled, labels in the five languages.
Configuration
- Enable the button: shows or hides the “Empty cart” button on the cart page.
- Require confirmation: displays a confirmation prompt before clearing, to prevent accidental clicks.
- Button label: text shown on the button, customizable and translatable in each language.
- Confirmation message: text of the confirmation prompt, customizable and translatable in each language.
The labels are multilingual fields: select each language in the field switcher to adapt the text. Default values are provided in all five languages from installation.
How it works
What is removed
On click (and after confirmation if enabled), the module removes all products from the cart — including their combinations and customizations — then removes all discount vouchers and cart rules applied. The cart returns to a fully empty state.
Automatic reload
Once the cart is cleared, the cart page reloads automatically to show the empty state, with no action from the customer.
Theme-independent injection
The assets (script and style) are loaded via the actionFrontControllerSetMedia hook, which is always called. The script then locates the cart block and inserts the button into it. This approach guarantees the button is displayed even when the theme does not fire the usual cart page display hooks.
If the theme fires the displayShoppingCartFooter hook, the button is rendered there directly and the script attaches to it without creating a duplicate.
Security
Clearing runs through an AJAX request protected by a token tied to the current cart, and only affects the current session’s cart. No other session or cart is affected.
FAQ and troubleshooting
The button does not appear on the cart page
Clear the PrestaShop cache (Advanced Parameters > Performance) and, while testing, disable Combine/Compress (CCC) and force template recompilation. Then reload the cart page in a private window. The button only shows when the cart contains at least one item.
My custom theme still does not show the button
The button is inserted into the first recognized cart container. If your theme uses a very specific structure, open the browser console: if the dfClearCart object is defined, the assets are loading correctly and only the insertion selector needs to be adapted to your cart block.
The cart only empties after a manual refresh
Make sure you are using the latest version of the module: the cart page reload is triggered automatically after clearing.
Is it compatible with PrestaShop 9?
Yes. The module is compatible with PrestaShop 8 and 9, in multistore and multilingual setups, with no deprecated method.