11 votes
Accepted

Differences between some stock methods

isSaleable() is just an alias of isSalable() : /** * Alias for isSalable() * * @return bool */ public function isSaleable() { return $this->isSalable(); } The isSalable() method looks ...
10 votes
Accepted

Magento 2 - Unlimited stock of a product

You can easily do this by visiting your Advanced Inventory Tab of your product. Just set Manage Stock option to No EDIT If your store contain all digital products then you can set below option by ...
  • 17.8k
10 votes
Accepted

Downloadable product on Magento 2.3.1 out of stock issue

In our case the issue was related to a migration from Magento 1 to Magento 2 via migration data tool. The problem is that default value for the attribute 'links_exist' is 0 in Magento 1. However in ...
8 votes

Magento 2 : How To Show Price of "out of stock" Products

This one adds to Sohel Rana's answer. Tested on 2.3.3 for configurable products For any of the product out of stock: In your di.xml <preference for="Magento\ConfigurableProduct\Pricing\Render\...
  • 111
7 votes

How to show "Out of Stock" text in dropdown option?

To show out of stock products go to System > Configuration > Catalog > Inventory and set Display Out of Stock Products to yes. Now we'll need to rewrite the class ...
  • 37.5k
7 votes

Out of stock products still appear in the frontend, search and others - Magento 2.1.0

Go to admin > Stores > configuration > Catalog > Inventory > Stock Options Set Display Out of Stock Products to NO
7 votes
Accepted

Magento 2: How to show Prices for OUT of stock products

You need to create your custom module using below code Let say module name Custom_Outofstock So create folder in app/code Create registration.php file at app/code/Custom/Outofstock/registration.php ...
6 votes
Accepted

how to get the stock status without loading the whole product-efficient way

You can use this code which give stock in faster way using product id $model=Mage::getModel('cataloginventory/stock_item'); $model->getResource()->loadByProductId($model, $productId); $data=$...
  • 76.6k
6 votes
Accepted

How to get only out of stock products in magento 2

$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollectionFactory = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory'); $...
6 votes

Differences between some stock methods

These all are methods which checked the product availability with different parameters . isInStock() - Its just check the product is in stock or not. And for this its check the product attribute ...
6 votes
Accepted

How to get all visible out of stock products in magento 2

After doing R&D found a solution to get all the out of stock products <?php namespace [VENDOR_NAME]\[MODULE_NAME]\Block; use Magento\Catalog\Model\Product\Attribute\Source\Status; use ...
  • 1,503
5 votes

Hide out of stock products in Layered Navigation

The "Display Out of Stock Products" option set to No will hide products that are completely out of stock. If you want these to be displayed, but also want filters to hide options where the simple ...
5 votes

Magento 2 : How To Show Price of "out of stock" Products

I just created a small module to show the price of out-of-stock items based on @Cotton 's answer. Feel free to fork: https://github.com/nordcomputer/magento2-showoutofstockprice Composer install ...
  • 423
5 votes

Magento2: show price for out of stock configurable products

Not sure if this is applicable, but I'm on Magento 2.1.9 and there is an issue with configurable products showing price of $0.00 when child products are out of stock on Github. The hack, Albeit a ...
  • 538
5 votes
Accepted

Display out of stock product only for specific Category in Magento2

To do above things, you need to do this things. Vendor\Extension\etc\di.xml <type name="Magento\CatalogInventory\Helper\Stock"> <plugin name="Vendor_Extension_Stock_Helper" type=...
4 votes

How to get only out of stock products in magento 2

By default in product collection join the cataloginventory_stock_status table so "stock_status_index.stock_status = 1" added into the query. To get the only out of stock products, first we need to ...
4 votes
Accepted

Magento2 set "in stock" when programmatically update qty

Try following code: $product->setQuantityAndStockStatus(['qty' => $qty, 'is_in_stock' => (bool)$qty]); OR $stockItem->setQty($qty); $stockItem->setIsInStock((bool)$qty);
  • 3,874
4 votes

How to get product collection with both in stock and out of stock products in Magento 2.1

Use below code $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\CollectionFactory'); $...
  • 3,289
4 votes

How to get product collection with both in stock and out of stock products in Magento 2.1

By default magento filters only in stock products in collection. We have to set the in stock filter as false. $productCollection = $_objectManager->create('Magento\Catalog\Model\ResourceModel\...
  • 580
4 votes
Accepted

Salable quantity of 0 but still showing in stock?

I was facing the same issue in one of my projects recently. In my case the client wanted to display stock availability label (i.e. Instock/Outofstock) on category pages as well. That is not available ...
3 votes

how to get the stock status without loading the whole product-efficient way

Try this $firstProductId = Mage::getSingleton('catalog/product')->getIdBySku('mysku'); $inStock = Mage::getModel('cataloginventory/stock_item')->getCollection()->addFieldToFilter('product_id'...
3 votes
Accepted

How to get product collection of out of stock items - opposite of addInStockFilterToCollection()?

let's say that $collection is your product collection that you build like this: $collection = Mage::getModel('catalog/product')->getCollection() ->...additional filters here...; now do ...
  • 197k
3 votes
Accepted

Auto-changing the “Stock Availability” from “Out of Stock” to “In Stock” on quantity change

Solution 1 Add this in config.xml <?xml version="1.0"?> <config> <modules> <Froggyline_HappyHour> <version>0.0.0</version> </...
  • 32.3k
3 votes
Accepted

Out of Stock & Backorder Status: Does default magento behaviour require "In Stock" status to purchase a backorder item

Yes it does. Check this out. Magento has in-built setting for turning on "Backordering". It is located at System >> Configuration >> Catalog >> Inventory but this will work only ...
  • 1,984
3 votes
Accepted

Magento 2 : How To Show Price of "out of stock" Products

You need to modify some logic for that. So create a new module and add following code. Vendor/Module/etc/frontend/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/...
3 votes

Display Out of Stock Simple Products swatches in configurable product

The above one is a known issue for Magento and can be solved partially by installing the below extension. https://github.com/interjar/configurable-child-visibility Reference for the Issue can be ...
3 votes
Accepted

How to show out of stock product configuration in Magento 2.2.7?

For anyone else coming here for a solution, I ended up creating a module for this, which is available from here: https://github.com/pkarsai/show-out-of-stock-products-magento2 The problem is – and ...
2 votes

Grey Out Sold Out products

If you are able to add an extra class to the product image of the sold out product then you can solve it with pure CSS. Check: https://gist.github.com/karlhorky/3478370
2 votes

How to filter loadedProductCollection to show out of stock products within a specific period?

So lets start with the obvious issue you have: The blank spaces. The issue, as you already know, is that your collection contains the count of products that are not to be displayed (as per your code ...
  • 9,856
2 votes

Show out of stock products at the end of product search results page

Sorry if solution isn't very clean. I just copied from one of the modules which has been written many years ago... etc/config.xml <catalog_product_collection_load_before> &...
  • 3,838

Only top scored, non community-wiki answers of a minimum length are eligible