Ever wonder how to change the number of products displayed in woocommerce shop pages? Some WooCommerce themes don’t display your product tiles in way you’d like. For example, say your theme is set to display 4 columns (the typical number of columns) but you don’t have the option to set the number of products per page from your theme’s options. In this example, we’ll say that your theme has set the number of products displayed on each page to 10. This is going to cause on odd layout because you’ll have two and a half rows of products on each page. Ideally, you want a multiple of 4 since that’s how many columns your page has. To change the number of products displayed, add this code to your theme’s functions.php:
// Display 24 products per page. Goes in functions.php add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );
Make sure the code goes within the php tags “<?php ?>” of your themes functions file (I recommend placing all additional snippets just inside the opening php tag for easy maintenance). This example changes the number of products shown on each page to 24. Therefore, if you don’t want 24 products on each page, change the 24 in ‘return 24’. Save and enjoy!
Note: You will need to add this code snippet again if you update/change your theme.