Skip to main content
Share Your Experience: Take the 2024 Developer Survey
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 ...
Raphael at Digital Pianism's user avatar
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 ...
Keyur Shah's user avatar
  • 18.1k
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 ...
mbernt - mediarox's user avatar
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\...
Cotton's user avatar
  • 121
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
Prashant Valanda's user avatar
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 ...
Prashant Valanda's user avatar
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'); $...
Rendy Eko Prastiyo's user avatar
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 ...
Ashish Jagnani's user avatar
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 ...
Kanhaiya lal's user avatar
  • 1,548
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 ...
Robert Egginton's user avatar
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 ...
Mario's user avatar
  • 478
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 ...
Jason's user avatar
  • 538
5 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\...
GenZ Dev's user avatar
  • 600
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=...
Dhiren Vasoya's user avatar
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 ...
Suman Singh's user avatar
  • 1,007
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);
Pratik Oza's user avatar
  • 3,992
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'); $...
Ansar Husain's user avatar
  • 3,429
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 ...
Pratik Navapara's user avatar
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/...
Sohel Rana's user avatar
  • 35.9k
3 votes
Accepted

Magento2 Display out of stock products at last

Try this solution: $collection->getSelect()->joinLeft( ['_inventory_table' => 'cataloginventory_stock_item'], "_inventory_table.product_id = e.entity_id", ['is_in_stock'...
Nikunj Vadariya's user avatar
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 ...
Priyesh Doshi's user avatar
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 ...
Peter Karsai's user avatar
3 votes

Where Inventory_stock_% table get updated in Magento 2?

I figured it out myself. Patch these two will get the other inventory stocks updated like the logic of the default one. @package magento/module-inventory-indexer --- Indexer/SelectBuilder.php +++ ...
Long Nguyen's user avatar
2 votes

Display In-Stock Seller/Vendor on top of product view page

You can order the position of seller in your collection by modifying your both the seller collection like below. As you have already filtered the Seller list by quantity having more than 0 value. By ...
Codrain Technolabs Pvt Ltd's user avatar
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 ...
ProxiBlue's user avatar
  • 9,926
2 votes
Accepted

Show out of stock products based on attribute value in layered navigation

After several tries I come up with the solution to my problem. I report my solution in case anyone will need it. The first thing to do is rewriting the Mage_Catalog_Model_Layer. I created a custom ...
giani.sim's user avatar
  • 1,473
2 votes

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

I was facing the exact same problem (Magento v2.1.9) due to "Backorders", which was set "Allow Qty Below 0 and Notify Customer" Go to admin > Stores > configuration > Catalog > Inventory > Stock ...
Nadeem0035's user avatar
  • 1,245
2 votes

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

NOPE. 3rd try with different solutions and this also does absolutely nothing. Out of stock items have no price. Any other thoughts on a working solution for Magento 2.2.6
user3608473's user avatar
2 votes
Accepted

Auto Update Configurable Products Stock Status with a cron job

The complete script will looks like this: <?php require_once('app/Mage.php'); //Path to Magento umask(0); Mage::app(); $collectionConfigurable = Mage::getResourceModel('catalog/...
Nidheesh's user avatar
  • 1,048
2 votes
Accepted

How to change Stock Availability automatically to '0'

Update view.phtml with below code. <?php /* */ ?> <?php $_helper = $this->helper('catalog/output'); ?> <?php $_product = $this->getProduct(); ?> <script type="text/...
Jaimin Sutariya's user avatar

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