sergiorx8 Posted March 14, 2021 Share Posted March 14, 2021 Good evening guys, I'm writing to see if you can help me with my PrestaShop 1.7. I need to update the product quantity within a product page using JS. It could be added easily in the beginning with a code like this: $ ("# quantity_wanted"). Val (4). The problem is that this alone is not valid since PrestaShop does not recognize this change in quantity since if I do this and click the add to cart button, it adds quantity 1 and another very important thing is that the total price does not change either. All this is done correctly if it is done manually by hitting the + and - button since it seems that it does a kind of ajax loading when pressing those buttons. From what I have read (https://devdocs.prestashop.com/1.7/themes/reference/javascript-events/) I think it could be done through PrestaShop JavaScript events but no matter how much I try, I can't find the solution. So far what I have achieved is this but it does not work either since neither the total price changes nor PrestaShop recognizes that the amount has changed. prestashop.emit('updateProduct', { eventType: 'updatedProductQuantity', event: $("#quantity_wanted").val(4) }); Any ideas? 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