Home » WooCommerce: Change Number of Products Per Page

WooCommerce: Change Number of Products Per Page

by Tutor Aspire

If you have many products and don’t want to use pagination (splitting the page in 1, 2, 3 or more pages), here’s the fix for you.

Edit the number of WooCommerce products per page (12 in this case)

PHP Snippet: Change “Products per Page” @ Shop and Loop Pages

The default number of products per page is 4 rows * 4 columns = 16 products.

Some themes may affect this default figure:

  • by using a snippet similar to the one below
  • or by following the settings defined at WordPress Dashboard > Reading > “Blog pages show at most”.

In the snippet below, simply define the number of products per page by changing “12” to whatever number you like.

/**
 * @snippet       Products per Page - WooCommerce Shop
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 3.6.2
 * @donate $9     https://tutoraspire.com
 */

add_filter( 'loop_shop_per_page', 'tutoraspire_redefine_products_per_page', 9999 );

function tutoraspire_redefine_products_per_page( $per_page ) {
  $per_page = 12;
  return $per_page;
}

You may also like