Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
product_alert_eu_website_customer.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
11 
13 $productRepository = $objectManager->get(ProductRepositoryInterface::class);
14 $product = $productRepository->get('SKU-3');
15 
17 $website = $objectManager->create(\Magento\Store\Model\Website::class);
18 $website->load('eu_website');
19 
20 $stock = $objectManager->create(\Magento\ProductAlert\Model\Stock::class);
21 $stock->setCustomerId(2)
22  ->setProductId($product->getId())
23  ->setWebsiteId($website->getId())
24  ->save();