Use Case
From a product with quantity 0 and Out of stock status.
I have an event
<event name="catalog_product_save_after">
<observer name="stock_alert" instance="CpyStockAlertObserverSaveProduct" />
</event>
Change the value adding quantity and setting in stock status
When I check the product saleable value in the observer
public function execute(Observer $observer)
{
$product = $observer->getProduct();
var_dump($product->isSaleable());
False is printed.
If I save a second time
Then true is printed.
Conclusion, I guess my observer runs before the value is really updated…I can’t understand why though as it’s supposed to be after the product save ?
So I guess an other observer is acting there but…I can’t tell which one, why and how to fix this.
Any help ?