How to change the WooCommerce number of products per page

How to change the WooCommerce number of products per page

One of the greatest advantages of WooCommerce is its variety of customization options. You can set up the appearance of your page in almost every aspect, which is excellent for customizing the product pages.

This article created by our team at WpDataTables will explore WooCommerce’s customization options, starting with the customization of WooCommerce number of products per page. How do you change the number of products per page?

This can be a very useful change for your website. For example, if the number of products currently showing on the page is damaging the functionality of the page, or if changing the number would increase the visibility of products, this can visually enhance your site.

It’s important to know how the WooCommerce number of products per page work, and how to change the number. A quick fix would be pagination, but if you don’t want to do that, this is what you can do to change the WooCommerce number of products per page.

Why Change the WooCommerce Number of Products per Page?

So when is it useful to change the default number of products per page?

  • When you want to increase your sales by displaying more information about each individual product, or if you want to change the overall display of your page. By default, the number of products on a page will be 16, and they will be displayed in 4 rows by 4 columns.
  • It makes it easier for your shoppers to scroll through your products and find what they are seeking, especially if you have many products to display. Users will get easily lost in a flood of products that they don’t want to buy. They’ll lose patience as they trawl through multiple pages of products before finding their preferred product.
  • To make your page more functional. This could be because you have too many products on your page, and various images or widgets do not pop up properly. Or, you are changing the image sizes that you want to display.

How to Change the WooCommerce Number of Products per Page

There are two easy solutions to this problem for WooCommerce users. You might be limited by your site’s theme, and some themes only allow for a few solutions that we’ll explain here.

Before commencing, it is vital to backup everything on your page, by backing up the functions.php file. It would also make sense to have a child theme in place, or everything might disappear after a while.

Here are two ways to change the number of products per page.

Solution #1: With the Theme Customizer

The easiest way to change the WooCommerce number of products per page is by changing the theme’s settings, however, first make sure your theme allows it. If it doesn’t, move on to the second solution.

If it does, follow these steps.

  • Go to your admin area in WordPress. Hover over the Appearance button.
  • A drop-down menu should appear where you can find the Customize option. Open it, and the WordPress theme customizer tool should open.

  • In the left sidebar, click on WooCommerce. Then, go to Product Catalog, and scroll down the left-hand side, where you can see the Products per Row Then, you can set the number of products per page to the preferred number. You can also customize the number of rows per page.
  • If this doesn’t appear in your theme’s customizing tool, then the theme doesn’t allow this option, so try the second solution!

Solution #2: With a Filter

This option is for everyone whose theme does not allow them to customize the products per page. You can use a very simple code snippet and incorporate it into your functions.php file. Simply follow these steps.

  • Go to your WordPress site’s files, and locate the child theme’s functions.php file. Normally, it should be located in /public_html/wp-content/themes/YourThemeName-child/functions.php.
  • If you’re using an add-on domain, then this folder will be: /public_html/YourDomain/wp-content/themes/YourThemeName-child/functions.php.
  • Then, you should add this code snippet on the bottom of the file, or before the closing tag. Here’s the code you’ll need to enter.
 /**
* 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;
  • Update the file, and save it. With this filter, you’ll now enable your users to see 9 products per page.
  • You can always modify the number to any value you want. To do that, change the value in $col = 9 to any value you want.

Changing the Number of Columns per Page

You can also change the number of columns per page; the above code will only change the number of products per page. You can easily change the default number of columns, which is 3, with the following code snippet:

// Change the Number of Columns Displayed Per Page
add_filter( 'loop_shop_columns', 'lw_loop_shop_columns' );
function lw_loop_shop_columns( $columns ) {
 $columns = 5;
 return $columns;
}

Enter this code snippet into the functions.php file. You can change the number of columns to any number you want; for example, if you want to set it to more than 5 columns, you can simply change the number after $columns =.

In this example, the number of products is changed to 12, and the number of columns to 5.

Create responsive tables, graphs, and charts for WordPress

If your business is growing and sales are increasing, then you can offer your users the chance to compare the products. You can also display comparisons, pricing tables, statistics, or other data with tables.

For this task, wpDataTables is recommended. It is a premium WordPress plugin for creating responsive tables, graphs, charts, which enables comparison of products and provides the data for your users.

Creating a table or a chart with the plugin is as easy:

  • Create the data.
  • Customize the table and add responsive elements, conditional formatting, multi-criteria filtering, and more.
  • Publish the table on your site, and enjoy the results.

Ending thoughts on changing the number of products per page in WooCommerce

Only use code snippets from reliable sources such as WordPress Codex, Github, or Stack Overflow to ensure no mistakes are made. Their developers have a lot of experience, and you can contact them anytime if there are any problems.

You can also use child themes for this. You can create child themes and easily make the changes you desire. The parent theme will remain intact, and you’ll be able to make easy but effective changes.

Hey, did you know data can be beautiful too?

wpDataTables can make it that way. There’s a good reason why it’s the #1 WordPress plugin for creating responsive tables and charts.

An actual example of wpDataTables in the wild

And it’s really easy to do something like this:

  1. You provide the table data
  2. Configure and customize it
  3. Publish it in a post or page

And it’s not just pretty, but also practical. You can make large tables with up to millions of rows, or you can use advanced filters and search, or you can go wild and make it editable.

“Yeah, but I just like Excel too much and there’s nothing like that on websites”. Yeah, there is. You can use conditional formatting like in Excel or Google Sheets.

Did I tell you you can create charts too with your data? And that’s only a small part. There are lots of other features for you.

If you enjoyed reading this article on how to change the WooCommerce number of products per page, you should check out this one about how to set WooCommerce related products.

We also wrote about a few related subjects like how to export export WooCommerce orders, WooCommerce product variations, WooCommerce appointments plugins, WooCommerce redirect after checkout, how to set up WooCommerce test mode, WooCommerce grouped product, WooCommerce variable product,  WooCommerce hide category from shop page and the best WooCommerce extra product options.