WooCommerce : How to Customize Posts Per Page

Sometimes you need to customize how many products display on your woocommerce catalog/shop page, but there are no reference on how to do that.

For a quick fix, you just need to put extra 4 lines of codes in the functions.php file at your theme.


add_filter('loop_shop_per_page',  'custom_products_per_page');
function custom_products_per_page() {
    return 9;


i have put 9 as the example above, so you can put any number so that that will be the total products will be display per page. Hope this tips can solve your headache and give you some idea.


  1. Is there a way to show all posts?

    such as the query_posts arg posts_per_page => -1

    I did come up with a solution where you would check to ensure that product subcategories are not overriding the specific category page, then update the wp_query, however -1 does not seem to work properly here either.

    I added the following to a custom archive-product.php template:

    global $woocommerce, $wp_query;
    if ( ! $product_category_found ) {
    $wp_query->post_count = 20;
    $args = array_merge( $wp_query->query_vars, array( ‘posts_per_page’ => ’20’ ) );
    query_posts( $args );

Leave a Comment.