M Iqbal Posted April 8, 2022 Share Posted April 8, 2022 Hello support, I am trying to use hookActionCartSave hook in my custom module but that hooks fire when i go to checkout and add customer information or login customer in Prestashop 1.6 and 1.7. I want the event when user add product to cart. As per Prestashop documentation i try to use actionCartUpdateQuantityBefore but no luck. Can anyone please help. Thank you. Link to comment Share on other sites More sharing options...
Janett Posted April 8, 2022 Share Posted April 8, 2022 hookActionCartSave is called each time a data of Cart has change. So it happens many times on same request. 1.6 you can use actionBeforeCartUpdateQty https://github.com/PrestaShop/PrestaShop-1.6/blob/1.6.1.24/classes/Cart.php#L959 1.7 you can use actionCartUpdateQuantityBefore https://github.com/PrestaShop/PrestaShop/blob/1.7.8.5/classes/Cart.php#L1558 Link to comment Share on other sites More sharing options...
Ress Posted April 8, 2022 Share Posted April 8, 2022 That hook works when you add something to the cart. Is the hook registered? If so, what exactly do you do that doesn't work? Link to comment Share on other sites More sharing options...
M Iqbal Posted April 11, 2022 Author Share Posted April 11, 2022 Basically, I am currently using hook hookActionCartSave , but this hooks fire when i go to checkout page and enter customer address / login customer after adding product to cart. I need an event when a product will be add / remove / qty update in cart. Link to comment Share on other sites More sharing options...
Ress Posted April 11, 2022 Share Posted April 11, 2022 That hook is executed when you add / delete a product, I tell you for sure. Do a simple test, type "exit;" in the hook, and check in the console, on the network, if the execution stops (you can also give a var_dump with a text, to see if it returns that text to you). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now