Jump to content

Add custom javascript on customer account creation


Recommended Posts

Hi, I'm trying to add some js script in the <head> tag go a page only when a customer successfully creates an account. It should be in the sign up process and in the checkout, when the client registers as a new customer.

Till now I've created a custom module and registering hookActionFrontControllerSetMedia I've been able to add my module custom javascript in the head, obviously it's in every page, but I want it only on registration event page.

Is there anyone that can help me?

Thanks

Link to comment
Share on other sites

  • 9 months later...

You could use the actionCustomerAccountAdd hook, which runs when someone logs in. Here, for example, you can save a cookie, which you can check where you register your js, then delete the cookie.

Link to comment
Share on other sites

On 5/27/2021 at 3:14 PM, martilu said:

Till now I've created a custom module and registering hookActionFrontControllerSetMedia I've been able to add my module custom javascript in the head, obviously it's in every page, but I want it only on registration event page.

Check the controller inside the hook and only add the JS when it's inside the desired one. Alternatively check prestashop.page.page_name inside your JS

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...