JoakDA
JoakDA

Reputation: 305

Prestashop 1.7 Hook actionCustomerAccountAdd not fired

I am trying to add a hook in my custom module but it is not fired after I add a customer both in prestashop backoffice or by using the webservice.

The hook name I am trying to register is "actionCustomerAccountAdd".

This is the relevant code of the module. Please could you help me? I am a PHP developer but it is the first time I develop in Prestashop side.

/**
     * Don't forget to create update methods if needed:
     * http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update
     */
    public function install()
    {
        return parent::install()
            && $this->createRequiredDBTables()
            && $this->registerHook('actionCustomerAccountAdd');
    }

I have this code to check in logs files or page but it is not fired:

public function hookActionCustomerAccountAdd($params)
    {
        $this->logger->info('Hook action customer account add fired');
        echo 'hook fired';
        die();
    }

Thank you.

Upvotes: 2

Views: 1552

Answers (1)

Krystian Podemski
Krystian Podemski

Reputation: 1491

The thing is that hook actionCustomerAccountAdd is fired only on front-office, you will need to use actionObjectCustomerAddAfter, dynamic hook executed in classes/ObjectModel.php

Upvotes: 4

Related Questions