/** * @param \Magento\Catalog\Api\ProductRepositoryInterface $subject * @param callable $proceed * @param string $productSku * @return bool * @throws \Exception * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundDeleteById(\Magento\Catalog\Api\ProductRepositoryInterface $subject, \Closure $proceed, $productSku) { $this->resourceModel->beginTransaction(); try { /** @var bool $result */ $result = $proceed($productSku); $this->resourceModel->commit(); return $result; } catch (\Exception $e) { $this->resourceModel->rollBack(); throw $e; } }