Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
configurable_options_advanced_inventory.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
12 
13 require __DIR__ . '/../../../Magento/ConfigurableProduct/_files/product_configurable.php';
14 
15 $objectManager = Bootstrap::getObjectManager();
16 
18 $stockItemRepository = $objectManager->get(StockItemRepositoryInterface::class);
19 
21 $product = $productRepository->get('simple_10');
22 
24 $stockItem = $product->getExtensionAttributes()->getStockItem();
25 $stockItem->setIsInStock(true)
26  ->setQty(10000)
27  ->setUseConfigMinSaleQty(false)
28  ->setMinSaleQty(500)
29  ->setUseConfigEnableQtyInc(false)
30  ->setEnableQtyIncrements(true)
31  ->setUseConfigQtyIncrements(false)
32  ->setQtyIncrements(500);
33 
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60