cancel
Showing results for 
Search instead for 
Did you mean: 

How to get product collection of out of stock items on a particular one category

How to get product collection of out of stock items on a particular one category

I have a requirement, to display a  products in two categories - one for the in stock items, the other for out of stock items. 

Hence If I disable the product status out of stock display then all categories are not showing out oof stock item, But other category which I created only for out of stock item is not displaying any product. 

Please suggest what should do.  Thanks for help.

2 REPLIES 2

Re: How to get product collection of out of stock items on a particular one category

Hello @r k_shrivastaw 

Magento is not giving this type of functionality. but that is not impossible.

Go to Store > Product > search the "Quantity" attribute and edit that

in that go to > Storefront Properties > set "Used for Sorting in Product Listing" as yes

Then the customer can filter the in-stock & Out of stock products from the filters

Regards, 
Deep

Re: How to get product collection of out of stock items on a particular one category

@r k_shrivastaw You can show both products in website by going to store->configuration->catalog.

 

There you find the option show out of stock products and make its value to yes.

Then you can fetch the product collection and show the out of stock products by checking the qty.

 

If qty is 0 then show the product in out of stock product category.

 

Thanks