Opencart 22.214.171.124 Hide 0 Stock Quantity In Category Page. In order not to show 0 stock quantity item / product from website, there is a little modification that you can do. Here is what happens to 0 stock quantity item in Opencart 126.96.36.199 by default. By design, 0 stock item are showing is because the item can be set as “pre-order” item. But if this is unnecessary (meaning you don’t have “pre-order”) in your web store , you can use this modification to avoid showing stock item with 0 quantity.
Items with 0 stock quantity is showing everywhere in your website and is still able to add-to-cart. This is made possible by design as explained above. We are going to change this so that 0 stocks items are not shown in any of our web pages.
In the shopping cart page, there will have a warning stating “Products marked with *** are not available in the desired quantity or not is stock” which sometimes is quite annoying to your customers.
Simple modification to this file will help removing all 0 stock item from showing. Open the file “catalog\model\catalog\product.php” and edit to add “AND p.quantity > ‘0’” after “p.status = 1“. Use find and replace all function in your program to do this the easy way else just go one by one and replace every command in the file as in image shown below:
And there you have it, all 0 stock items will not be shown everywhere in your web pages.
Note: remember that this modification helps if you are not doing any “pre-orders” item cause it no longer allow you to pre-order once the quantity is set to 0 in your product page.