2

I got following error in magento2, Product that you are trying to add is not available .This product is out of stock and in admin we changed the following settings.

  1. "Display Out of Stock Products" as Yes
  2. "Backorders" as Allow Qty Below 0

Thanks

3
  • Did you fix this? i have the same problem i cant figure it out!! only on around 5% of products but they are in stock. – Gaz Smith Jan 23 '20 at 11:50
  • No, Still this issue there @GazSmith – Soundararajan m Jan 24 '20 at 9:17
  • Ive fixed it, ill put an answer for you – Gaz Smith Jan 24 '20 at 23:18
0

This error can also appear if you added a new product type, created products from that product type and then remove the product type or change its identifier.

If you now try to load a product with the sku of such a product and add it to the quote, then the error will appear, because you are trying to add a product with a non existing product type.

To solve it, I searched the product

SELECT * FROM `catalog_product_entity` WHERE type_id LIKE "%enter-the-product-type-here%"

and removed it or change the type_id to the new type id.

0

The Magento MSI module assigns your products to a location (source). Sometimes this does not happen after upgrading. This script will add those products to your default stock location.

INSERT IGNORE INTO `inventory_source_item` (source_code, sku, quantity, status)

SELECT 'default', sku, qty, stock_status 
FROM (`cataloginventory_stock_status` AS `lg` 
JOIN `catalog_product_entity` AS `prd` 
  ON ((`lg`.`product_id` = `prd`.`entity_id`)))

You may also have lots of orders at PROCESSING state / status. This will mean that your products are being reserved in the inventory_reservation table. There is a really crude bug that, although they are reserved, it does not mark them as out of stock.

To disable stock reservation like this, use the following module by AmpersandHQ

https://github.com/AmpersandHQ/magento2-disable-stock-reservation/

This stops the product from being added to the reservation table and instead deducts stock on order like in Magento 1.

If it's neither of those things, you'll need to check your exception.log and system.log and possibly your server logs.

Failing all of that. Disable Magento MSI modules.

php bin/magento module:disable Magento_Inventory Magento_InventoryAdminUi Magento_InventoryApi Magento_InventoryBundleProduct Magento_InventoryBundleProductAdminUi Magento_InventoryCatalog Magento_InventorySales Magento_InventoryCatalogAdminUi Magento_InventoryCatalogApi Magento_InventoryCatalogSearch Magento_InventoryConfigurableProduct Magento_InventoryConfigurableProductAdminUi Magento_InventoryConfigurableProductIndexer Magento_InventoryConfiguration Magento_InventoryConfigurationApi Magento_InventoryGroupedProduct Magento_InventoryGroupedProductAdminUi Magento_InventoryGroupedProductIndexer Magento_InventoryImportExport Magento_InventoryIndexer Magento_InventoryLowQuantityNotification Magento_InventoryLowQuantityNotificationAdminUi Magento_InventoryLowQuantityNotificationApi Magento_InventoryMultiDimensionalIndexerApi Magento_InventoryProductAlert Magento_InventoryReservations Magento_InventoryReservationsApi Magento_InventoryCache Magento_InventorySalesAdminUi Magento_InventorySalesApi Magento_InventorySalesFrontendUi Magento_InventoryShipping Magento_InventorySourceDeductionApi Magento_InventorySourceSelection Magento_InventorySourceSelectionApi Magento_InventoryShippingAdminUi Magento_InventoryDistanceBasedSourceSelectionAdminUi Magento_InventoryDistanceBasedSourceSelectionApi Magento_InventoryElasticsearch Magento_InventoryExportStockApi Magento_InventoryReservationCli Magento_InventoryExportStock Magento_CatalogInventoryGraphQl Magento_InventorySetupFixtureGenerator Magento_InventoryAdvancedCheckout Magento_InventoryDistanceBasedSourceSelection Magento_InventoryRequisitionList Magento_InventoryGraphQl
-1

First, take a backup of the inventory_source_item table.

Now execute below SQL query in MySQL,

INSERT IGNORE INTO `inventory_source_item` (source_code, sku, quantity, status)

SELECT 'default', sku, qty, stock_status 
FROM (`cataloginventory_stock_status` AS `lg` 
JOIN `catalog_product_entity` AS `prd` 
  ON ((`lg`.`product_id` = `prd`.`entity_id`)))

Execute the below commands:

  • php bin/magento indexer:reindex
  • php bin/magento cache:flush
1
  • 1
    what does it do, can you explain? – Mohit Rane Aug 18 '20 at 8:04

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.