Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-inventory-product-alert
Test
_files
product_alert_customer.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Catalog\Api\ProductRepositoryInterface
;
9
10
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
11
13
$productRepository
=
$objectManager
->get(ProductRepositoryInterface::class);
14
$product
=
$productRepository
->get(
'SKU-3'
);
15
16
$stock
=
$objectManager
->create(\
Magento
\ProductAlert\Model\Stock::class);
17
$stock
->setCustomerId(1)
18
->setProductId(
$product
->getId())
19
->setWebsiteId(1)
20
->save();
$stock
$stock
Definition:
product_alert_customer.php:16
Magento\Catalog\Api\ProductRepositoryInterface
Definition:
ProductRepositoryInterface.php:14
$objectManager
$objectManager
Definition:
product_alert_customer.php:10
$product
$product
Definition:
product_alert_customer.php:14
Magento
$productRepository
$productRepository
Definition:
product_alert_customer.php:13
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125