Search code examples
wordpresspluginswoocommerce

Hide 'out of stock' products in Woocommerce


Under "Products" and "Inventory" I have checked the following setting: "Hide out of stock items from the catalog"

Now all sold out products are hidden in the archive/category view. So far so good.

The problem is that the hidden (out of stock) products are counted per page. So if there are 3 products that are sold out on the first page, only the ones in stock are showing (6).

It also seems that these "hidden" products still are searchable as well, and visible through the different widgets.

Any ideas how to fix this? I mean to REALLY hide products that are out of stock. Or do I need to manuallly remove them?


Solution

  • Note to self: Always read the changelog from developer.

    Found the answer here: http://develop.woothemes.com/woocommerce/2014/02/solving-common-issues-after-updating-to-woocommerce-2-1/#category-counts-incorrect

    In case the product counts for categories are showing a too high or too low number, after updating to WooCommerce 2.1 there is an easy workaround.

    Go to the ‘Tools’ tab inside the WooCommerce > System Status of your WordPress administration panel. Here you first use the ‘Recount terms’ button and after that use the ‘Clear transients’ button. This will force the system to recount all the products the next time a category is loaded.

    Update: Also remember that it is not enough to change stock quantity to 0. You must also set "Stock status" to "Out of stock". If not the product will be counted in the shop, even if there are no products in stock.