diff --git a/contribute/contribute-pull-requests/add_hook.md b/contribute/contribute-pull-requests/add_hook.md new file mode 100644 index 0000000000..00fde8150c --- /dev/null +++ b/contribute/contribute-pull-requests/add_hook.md @@ -0,0 +1,14 @@ +# How To add a new Hook +Adding a new hook is quite a simple process. It can be done in only tree steps. + +## 1) Add a call to Hook::exec() + +As you can see on this [PR](https://github.com/PrestaShop/PrestaShop/pull/34431/files) Adding a simple Hook::exex() statement is enought to add a new hook. In order for it to be complete, there is a couple more steps to do. + +## 2) Modify the hook.xlm file + +In order to properly register the hook you need to add it to the hook.xml file as seen in this [PR](https://github.com/PrestaShop/PrestaShop/pull/34431/files) + +## 3) Add the new hook in the Autoupgrade fixture + +Finally, to allow your new hook to be available during an update, you need to add it to the current version SQL script of the Autoupgrade module. As it can be seen in this [PR](https://github.com/PrestaShop/autoupgrade/pull/672/files) \ No newline at end of file