0

How can I get a list of products that have 0 saleable quantity using either the product repository or collection (if not possible in repository).

Something like

$searchCriteria = $this->searchCriteriaBuilder->addFilter('saleable_qty', 0)->create();
$products = $this->productRepository->getList($searchCriteria);

1 Answer 1

1
  1. Salable quantity not stored in any product's table. It is maintained in inventory_stock_1 under Views. Hence you cannot get from the collection or repository directly. enter image description here
  2. To get salable quantity of the product we can use Magento\InventorySalesAdminUi\Model\GetSalableQuantityDataBySku. Please check the Get Salable Quantity in Magento 2.3
  3. Salable quantity can be checked for those product types which can maintain qty such as simple and virtual. The configurable, grouped and bundle depends upon simple products. Downloadable does not maintain qty and it will be No manage stock. enter image description hereenter image description hereenter image description hereenter image description hereenter image description hereenter image description here
  4. Please do not get confused with is_saleable value and salable quantity.
  5. Please check the attached custom script to get the list of products of salable quantity 0. If you want to do this in the module, please understand and take the logic to the module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.