Reputation: 1612
I am building a simple module where I need to catch a backoffice quantity modification event (for product or variations) in real time and send the new quantity to an external API.
I am struggling in understanding which hook to use to get the actual user inserted quantity and not the "previous" product quantity.
If I use the static method StockAvailable::getQuantityAvailableByProduct inside the hookActionProductUpdate in my module, I am getting the original product quantity and not the new one, probably because the hook is called before the actual DB update.
Any clue ?
Upvotes: 0
Views: 1108
Reputation: 1273
Try with: actionUpdateQuantity
You can pass the next parameters:
array(
'id_product' => (int) Product ID,
'id_product_attribute' => (int) Product attribute ID,
'quantity' => (int) New product quantity
);
List of hook here : https://devdocs.prestashop.com/1.7/modules/concepts/hooks/list-of-hooks/
Upvotes: 0