Do you know how to insert custom hooks in PrestaShop 1.7? Because it’s most important thing to add your own hooks while development of theme or module using PrestaShop 1.7. In this tutorial I will guide you to add your custom hooks. Follow the below steps,

1. Go to Theme directory / config / theme.yml file and find the block “hooks”:

2. Inside the hooks block add the below construction


     custom_hooks:
       - name: yourCustomHookName
         title: yourCustomHookName
         description: Adds Block before the footer block
	
	

Modified file will be look like as below.

global_settings:
  configuration:
    PS_IMAGE_QUALITY: png
  modules:
   to_enable:
     - ps_linklist
  hooks:
    custom_hooks:
      - name: yourCustomHookName
        title: yourCustomHookName
        description: Adds Block before the footer block
    modules_to_hook:
      displayNav1:
        - ps_contactinfo
      displayNav2:
        - ps_languageselector
        - ps_currencyselector
        - ps_customersignin
        - ps_shoppingcart

Here, We have just registered custom hook so it can be accessible in any template.

3. Now, you need to place hook in the template file. For example, Go to : Theme directory > templates > _partials > footer.tpl

4. Now add the custom hook as below,

{hook h='yourCustomHookName'}

Modified file will be look like as below.

{hook h=’yourCustomHookName’}

 

That’s all. Once you upload the theme, you will find the above hooks on the transplant module page to transplant your module before the footer container block.