# Hook: definition

> A hook is a specific point in PrestaShop's code where a module can run its own logic, without touching the core files.

- Source canonique : [https://allaux.fr/en/glossaire/hook](https://allaux.fr/en/glossaire/hook)
- Langue : EN
- Dernière mise à jour : 2026-09-30

## What a hook is for

PrestaShop fires dozens of hooks at specific moments: header rendering, a product added to the cart, an order validated, footer rendering. A module attaches to one by calling registerHook() on install, then implementing a method named after the hook, for example hookDisplayHeader to insert a tag into the <head>, or hookActionValidateOrder to react to every validated order.

This mechanism avoids modifying PrestaShop's native files. For an online seller, it's what guarantees that a feature added by a module keeps working after a shop update, as long as the hook still exists in the target version.

The downside shows up when several modules attach to the same hook: their execution order, adjustable in the back office, can cause visual conflicts if two modules inject content in the same spot.

## In practice

> A cookie banner module typically uses the displayHeader hook to inject its script.

## FAQ

### Can a hook be added to a page that doesn't offer one?

Yes, through a custom hook declared by a module or a theme, but that requires development: by default, only hooks already present on the page are available.

### Why does an installed module show nothing on the shop?

Often because it's not positioned on the right hook, or the theme doesn't call that hook in its templates. This can be checked in the back office's module positions.

### Is it risky to edit a hookXxx method in a third-party module?

Yes: the change will be lost the next time the module gets replaced during an update. It's better to build a dedicated module for a lasting need.
