9 use Magento\Catalog\Model\ProductFactory;
12 use Magento\CatalogInventory\Api\StockItemCriteriaInterfaceFactory;
76 $scopeId = $this->stockConfiguration->getDefaultScopeId();
77 return $this->stockRegistryProvider->getStock($scopeId);
87 $scopeId = $this->stockConfiguration->getDefaultScopeId();
88 return $this->stockRegistryProvider->getStockItem(
$productId, $scopeId);
99 $scopeId = $this->stockConfiguration->getDefaultScopeId();
101 return $this->stockRegistryProvider->getStockItem(
$productId, $scopeId);
111 $scopeId = $this->stockConfiguration->getDefaultScopeId();
112 return $this->stockRegistryProvider->getStockStatus(
$productId, $scopeId);
123 $scopeId = $this->stockConfiguration->getDefaultScopeId();
136 $scopeId = $this->stockConfiguration->getDefaultScopeId();
138 return $stockStatus->getStockStatus();
149 $scopeId = $this->stockConfiguration->getDefaultScopeId();
159 $criteria = $this->criteriaFactory->create();
160 $criteria->setLimit($currentPage, $pageSize);
161 $criteria->setScopeFilter($scopeId);
162 $criteria->setQtyFilter(
'<=', $qty);
163 $criteria->addField(
'qty');
164 return $this->stockItemRepository->getList($criteria);
175 $data = $stockItem->getData();
176 if ($origStockItem->getItemId()) {
177 unset(
$data[
'item_id']);
179 $origStockItem->addData(
$data);
181 return $this->stockItemRepository->save($origStockItem)->getItemId();
191 $product = $this->productFactory->create();
194 throw new \Magento\Framework\Exception\NoSuchEntityException(
196 'The Product with the "%1" SKU doesn\'t exist.',
getStockItem($productId, $scopeId=null)
getStockStatus($productId, $scopeId=null)
updateStockItemBySku($productSku, \Magento\CatalogInventory\Api\Data\StockItemInterface $stockItem)
getProductStockStatus($productId, $scopeId=null)
getLowStockItems($scopeId, $qty, $currentPage=1, $pageSize=0)
getProductStockStatusBySku($productSku, $scopeId=null)
__construct(StockConfigurationInterface $stockConfiguration, StockRegistryProviderInterface $stockRegistryProvider, StockItemRepositoryInterface $stockItemRepository, StockItemCriteriaInterfaceFactory $criteriaFactory, ProductFactory $productFactory)
getStockStatusBySku($productSku, $scopeId=null)
getStockItemBySku($productSku, $scopeId=null)
resolveProductId($productSku)