Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
stock_with_sales_channels_rollback.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
10 
12 $stockRepository = Bootstrap::getObjectManager()->get(StockRepositoryInterface::class);
13 
14 // Firstly clear relations with sales channels
16 $stock->getExtensionAttributes()->setSalesChannels([]);
18 
19 $stockRepository->deleteById(10);