/** * @inheritdoc */ public function delete(StockItemInterface $stockItem) { try { $this->resource->delete($stockItem); } catch (\Exception $exception) { throw new CouldNotDeleteException(__($exception->getMessage())); } return true; }
/** * @inheritdoc */ public function delete(StockItemInterface $stockItem) { try { $this->resource->delete($stockItem); $this->getStockRegistryStorage()->removeStockItem($stockItem->getProductId()); $this->getStockRegistryStorage()->removeStockStatus($stockItem->getProductId()); } catch (\Exception $exception) { throw new CouldNotDeleteException(__('Unable to remove Stock Item with id "%1"', $stockItem->getItemId()), $exception); } return true; }