Support » Plugin: WooCommerce » Hided products counted in products per page

  • 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. So far so good.

    Then I wanted to change how many products that are visible each page (9 products, 3 each row). So I added the following code to my functions.php:

    add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 9;' ), 20 );
    add_filter('loop_shop_columns', 'loop_columns');
    if (!function_exists('loop_columns')) {
    function loop_columns() {
    return 3; // 3 products per row

    The problem here 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).

    Any ideas how to fix this?

  • The topic ‘Hided products counted in products per page’ is closed to new replies.