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
magento2-base
dev
tests
integration
testsuite
Magento
CatalogInventory
_files
configurable_options_advanced_inventory.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
use
Magento\Catalog\Api\Data\ProductInterface
;
9
use
Magento\CatalogInventory\Api\Data\StockItemInterface
;
10
use
Magento\CatalogInventory\Api\StockItemRepositoryInterface
;
11
use
Magento\TestFramework\Helper\Bootstrap
;
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
34
$stockItemRepository
->save(
$stockItem
);
Magento\CatalogInventory\Api\Data\StockItemInterface
Definition:
StockItemInterface.php:19
$objectManager
$objectManager
Definition:
configurable_options_advanced_inventory.php:15
Magento\TestFramework\Helper\Bootstrap
Definition:
Bootstrap.php:12
$stockItemRepository
$stockItemRepository
Definition:
configurable_options_advanced_inventory.php:18
__DIR__
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition:
_bootstrap.php:60
$productRepository
$productRepository
Definition:
bundle_product_with_not_visible_children.php:18
$stockItem
$stockItem
Definition:
configurable_options_advanced_inventory.php:24
$product
$product
Definition:
configurable_options_advanced_inventory.php:21
Magento\CatalogInventory\Api\StockItemRepositoryInterface
Definition:
StockItemRepositoryInterface.php:17
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14