/** * {@inheritdoc} */ public function delete(\Magento\Catalog\Api\Data\CategoryInterface $category) { try { $categoryId = $category->getId(); $this->categoryResource->delete($category); } catch (\Exception $e) { throw new StateException(__('Cannot delete category with id %1', $category->getId()), $e); } unset($this->instances[$categoryId]); return true; }