Available for projects & agency overflow · Quick reply, from the person who does the work

Override: definition

An override is a file placed in PrestaShop's override/ folder that replaces the behaviour of a core class, without modifying the original file.

Describe my issue Send a message

How an override works

Every PrestaShop class, for example Product or Order, can be overridden by creating a file of the same name in override/classes (or override/controllers for a controller). PrestaShop loads this version instead of the original, which makes it possible to change a specific behaviour without touching the CMS's source code.

Unlike a module, which hooks into hooks defined in advance without rewriting any existing method, an override can redefine any method of a core class. That's more powerful, but also more fragile.

The risk shows up at update time. If PrestaShop changes the original class, an override written against the older version can conflict with it, trigger an error, or silently ignore the change. Overrides should therefore be reserved for needs that hooks don't cover, and documented ahead of every version upgrade.

Frequently asked questions

Should overrides be avoided as much as possible?
Yes, wherever possible: a module built on hooks is easier to maintain. An override still earns its keep when no hook can reach the desired behaviour.
How do you know if a store contains overrides?
Simply check the contents of the override/classes and override/controllers folders: any file present there indicates an active override.
Can an override coexist with a module on the same feature?
Yes, but it complicates diagnosis when a bug occurs, since the final behaviour depends on both the hook run by the module and the method rewritten by the override.

Describe your need in one minute

A few targeted questions so I can reply with an estimate rather than another questionnaire.

contexte
plateforme (facultatif)
question (facultatif)
Please provide an email or a phone number so I can get back to you.

Please provide an email or a phone number so I can get back to you.