I try to get status of stock but i get this error message:
Fatal error: Call to a member function getIsInStock() on null with $stockProduct = $product->getStockItem()->getIsInStock();
I got this error message when i try to create a new product.
I'm using observer: catalog_product_save_after