• Hi, for my client the newest Woo not showing all products in a category.

    there is 7 products but it shows only 2.
    Please help.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi trejka,

    Put following lines of code into your currently activated theme’s functions.php. This should resolve your problem.

    function show_all_products($query){
    $query->set(‘posts_per_page’, -1);
    return $query;
    }
    add_filter(‘pre_get_posts’, ‘show_all_products’);

    Thread Starter trejka

    (@trejka)

    Hi, thx, but no luck.
    I’ve got:
    HTTP ERROR 500

    Any ideas?
    All the best
    Bart

    Hi,

    Yes, I got it. This is because of default format of single quotes (‘). Please change all the single quotes by retyping it after copying the code I have given.

    Actually, this comment area formats the quotes as opening (‘) and closing(‘) quotes but we need the similar straight quote to make proper string in the .php file. Please match them(‘) with any other functions written in the same functions.php file with prefix “add_action” or “add_filter”.

    I am sure this code will work as I have used it many times successfully.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Not all products are shown in a category’ is closed to new replies.