Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.

You might want to read an updated version of this page for the current version, PrestaShop 8. Read the updated version of this page

Learn how to upgrade to the latest version.

Create hooks available in Front Office

This section of the documentation is only about front office hooks: display and action.

Creating a dynamic hook

When your module or theme calls a hook, PrestaShop executes it.

This is how it is called from a PHP file:


This is how it is called from a Smarty template:

{hook h='MyCustomHook'}

Register the hook to make it visible and reusable

If you add a hook call, it is better to register it.

This will enable Back Office user to:

  • see it in the hooks list
  • be able to plug some modules on it (in Position page)
  • allow other modules to listen to this hook being called and add some extra behavior

You can register your hook from your theme’s theme.yml file:

      - name: displayFooterBefore
        title: displayFooterBefore
        description: Add a widget area above the footer

You can also register your hook from a module:

// Create the function for the MyCustomHook hook public function
MyCustomHook($params) { // method body }

// Register the MyCustomHook hook

// Call it from PHP