Prestashop Override Class [updated] ❲SECURE ⟶❳

In Object-Oriented Programming, an override allows you to take an existing class and "rewrite" specific methods. PrestaShop is built to look in the /override/ folder before it loads its core classes. If it finds a file there that matches the core class, it uses your version instead. Why Use Overrides?

Delete the file /var/cache/prod/class_index.php (or /dev/class_index.php if you are in debug mode). Overriding via a Module

When overriding classes in PrestaShop, keep in mind: prestashop override class

Modify the getProductPrice method in Product class to apply a special discount for VIP customers.

An is a PHP class that extends a native PrestaShop class, placed in a specific directory path that mirrors the original class’s location within the /override/ root folder. In Object-Oriented Programming, an override allows you to

When PrestaShop loads a class, its autoloader checks for an override file first. If found, it loads the override instead of the original core class.

Report prepared for: PrestaShop Developers & Technical Architects Document version: 1.0 Last updated: 2025 Why Use Overrides

PrestaShop uses PHP inheritance to swap core classes with your custom versions. Every core class (e.g., Product ) is technically defined as ProductCore . When you create an override file, the PrestaShop class auto-loading function prioritizes your version over the core one. Overrides are stored in the /override/ directory.

In this example, the ProductOverride class extends the original Product class and adds a new method getPriceWithDiscount .

PrestaShop uses a custom Autoload class that scans /override/ at runtime (or caches the mapping). When a class is instantiated, the autoloader loads the override version if present.

If you’ve ever wanted to change how PrestaShop handles a specific feature—like modifying how taxes are calculated or adding a custom field to a Product—you might be tempted to edit the core files directly.