DARKF3D3 Posted December 24, 2025 Share Posted December 24, 2025 Hi everyone, I'm developing a custom module that tracks product views, sales, and add-to-cart events to calculate dynamic relevance scores. The goal is to increment a counter every time a product is added to the cart. I've already tried the following hooks: actionObjectCartAddAfter → only triggers when the cart is first created (i.e. first product added) actionCartSave → doesn't trigger on AJAX add-to-cart actionCartUpdateQuantityAfter → never triggered during cart updates actionProductAddToCartLinkAfter → never triggered either None of these hooks seem to fire consistently when a product is added to the cart. Is there a hook in PrestaShop 8/9 that is triggered every time a product is added to the cart? Thanks in advance! Link to comment Share on other sites More sharing options...
wepresta Posted December 29, 2025 Share Posted December 29, 2025 Hi, In PS 8/9 there isn’t a single “add_to_cart” hook that fires only for that action. The most reliable one is: actionCartUpdateQuantityAfter It is triggered from Cart::updateQty() for every add/update/remove (including AJAX add-to-cart). To count only real “adds”, filter the params, for example: operator = up quantity > 0 use id_product / id_product_attribute If you want “first time this product is added” (not quantity increase), you need to compare with the previous quantity (or check if the product was already in cart_product before the update). This hook is the one most modules use for consistent tracking in PS 1.7/8/9. 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