Support » Plugin: WooCommerce » Change number of products per page

  • Resolved Deon B

    (@deon-b)


    Hi,
    I want to change the number of products showed per page
    I added this in my functions.php but nothing changes:

    Any suggestions?

    /**
     * Change number of products that are displayed per page (shop page)
     */
    add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
    
    function new_loop_shop_per_page( $cols ) {
      // $cols contains the current number of products per page based on the value stored on Options -> Reading
      // Return the number of products you wanna show per page.
      $cols = 9;
      return $cols;
    }

    thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @deon-b!

    Use the following code:

    add_filter( 'loop_shop_per_page', 'wc_redefine_products_per_page', 9999 );
    
    function wc_redefine_products_per_page( $per_page ) {
      $per_page = 9;
      return $per_page;
    }

    You can add this code to your site using the Code snippets plugin.

    Some more information on how to correctly add custom code to your site can be found here:

    http://rynaldo.com/how-to-add-custom-code-to-your-woocommerce-wordpress-site-the-right-way/

    Cheers!

    Hi
    thank you, I tried this right now (ok I didn’t use the code snippet plugin, but as a test I just pasted it at the bottom of my functions.php – then if it worked I would have used the plugin) and it doesn’t work.

    Any suggestions what I could be doing wrong?

    thank you

    I was thinking that maybe I should have installed code snippets and paste the code there instead of the bottom of functions.php

    So I pasted your code in code snippets right now, and behold! a fatal error 🙂

    Maybe anybody else has any idea how to change the number of products displayed for each page?

    thank you!

    Plugin Support Linda

    (@lindamork)

    Automattic Happiness Engineer

    Hi there,

    Have you tried using the settings in the Customizer to set the number of products and products per row are displayed? You can find those settings in Appearance > Customize > WooCommerce > Product Catalog.

    Plugin Support Linda

    (@lindamork)

    Automattic Happiness Engineer

    Hi there,

    We haven’t heard back from you in a while so I’m going to go ahead and mark this ticket as Resolved. Please open a new ticket if you need further help with this issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.