cancel
Showing results for 
Search instead for 
Did you mean: 

Out of stock products not in layered navigation

Out of stock products not in layered navigation

Ive noticed something in 2.2 that is not the same behaviour as m1, in the layered navigation any out of stock products the attributes don't show if it's out of stock.This is for simple products that I'm having the issue. And set to show out of stock products. 

 

If i set the product to in stock the color attribute for that product - example "Red" then comes back into the list of colors.

 

If the product is out of stock it still shows in the category list but the attribute is then hidden from the layered navigation color attribute list but if i use the url to access the filter directly when it was in stock i copied the url, and viewing it in a new tab the collection loads and does not create an error, is this a bug that the attribute is not showing when the product is out of stock if not what would I be able to do to allow the attribute to show even when out of stock.

4 REPLIES 4

Re: Out of stock products not in layered navigation

@Sugarloaf

can i know your magento version?


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Out of stock products not in layered navigation

2.2 Smiley Happy

Re: Out of stock products not in layered navigation

Hello,

 

change  this file

 

 

https://github.com/RomaKis/magento2/blob/0c82649c1f6e9151a5503782bdf874e3d4606fa8/app/code/Magento/C... compare with your file 

 

mainly below thing:-  $subSelect->where('stock_index.stock_status = ?', Stock::STOCK_IN_STOCK);

 

and do reindex and check it.

 

If that work then mark as solution


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Out of stock products not in layered navigation

@Sugarloaf

 

still any issue?

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer