35 throw new InputException(
__(
'There are not websites for assign to product'));
37 $product = $this->productRepository->get($productWebsiteLink->
getSku());
40 $this->productRepository->save(
$product);
41 }
catch (\Exception $e) {
44 'Could not assign product "%1" to websites "%2"',
67 $product = $this->productRepository->get($sku);
71 $this->productRepository->save(
$product);
72 }
catch (\Exception $e) {
75 'Could not save product "%1" with websites %2',
77 implode(
', ',
$product->getWebsiteIds())
deleteById($sku, $websiteId)
__construct(\Magento\Catalog\Api\ProductRepositoryInterface $productRepository)
save(ProductWebsiteLinkInterface $productWebsiteLink)