cancel
Showing results for 
Search instead for 
Did you mean: 

Configurable products not displaying items that are out of stock

Re: Configurable products not displaying items that are out of stock

Only solution I found is Amasty's 3rd party extension called "Out Of Stock Notification"

When this is installed, it displays all missing configurable items. 

Re: Configurable products not displaying items that are out of stock

This may be last reply. But this may help some one.

 

to acheive this you have rewrite the Magento block file, like below.

in your Custom Module etc/di.xml

<preference for="Magento\ConfigurableProduct\Block\Product\View\Type\Configurable" type="Vendor\Mymodule\Block\Product\View\Type\Configurable"/>

 Then create a Configurable.php

namespace Vendor\Mymodule\Block\Product\View\Type;
class Configurable extends \Magento\ConfigurableProduct\Block\Product\View\Type\Configurable {
public function getAllowProducts()
{
if (!$this->hasAllowProducts()) {
// $skipSaleableCheck = $this->catalogProduct->getSkipSaleableCheck();
$skipSaleableCheck = 1;
$products = $skipSaleableCheck ?
$this->getProduct()->getTypeInstance()->getUsedProducts($this->getProduct(), null) :
$this->getProduct()->getTypeInstance()->getSalableUsedProducts($this->getProduct(), null);
$this->setAllowProducts($products);
}
return $this->getData('allow_products');
}

}

Re: Configurable products not displaying items that are out of stock

This blows my mind.

How the hell can this be an intended feature?

 

Magento is an eCommerce Software. I would argue, above 70% of stores want to show that there was an item in a different size or color available because it returns later.

 

Do you have a way to excalate this and bring it to the developers attention? @Rakesh Jesadiya 

Re: Configurable products not displaying items that are out of stock

Hi, I don't know if still have this issue. I just faced the same, and I fixed just by changing a false for a true. I'm with you that this should be a configuration, but in 2.4.4, is still happening.

 

In this class 

\Magento\ConfigurableProduct\Model\Product\Type\Configurable

line 1290 (Magento 2.4.4) function getUsedProducts(), is calling to 

getConfiguredUsedProductCollection

if you change the second parameter to "true" then the swatch will work, and you will get the out of stock crossed down.

Of course, do it the right way... I'm just telling you where this logic is.