Chapter 2. Hooks

A hook is the most essential concept to understand if you want to code a PrestaShop module, but as you will see, it's very easy.

Hooks are points on which you can attach modules in a way to change the normal behavior of the shop. In the PrestaShop 1.5/1.6 source code, their names are usually prefixed with display or action, depending on their purpose.

The display type hooks are generally used to add HTML or JS code on all or specific pages (for example, to add a block in a column, add an accessories link on a product page, add a field in a form, add information on a confirmation order page, and so on).

The action type hooks are used to change the behavior of the software by adding actions when events are triggered (for example, ...

Get PrestaShop Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.