2 approaches to this. Compare them and pick what fits your setup.
Main approach
by Amit Dholiya
Control how many products WooCommerce displays on each Shop or product archive page.
Steps
- Add the code below to your theme's
functions.php. - Change
12to your preferred number. - Save and refresh the Shop page.
/**
* Change WooCommerce products per page
*/
function custom_woocommerce_products_per_page( $products ) {
return 12;
}
add_filter( 'loop_shop_per_page', 'custom_woocommerce_products_per_page', 20 );
This is the faster method to change the number of products per page in WooCommerce
add_filter( 'loop_shop_per_page', function() {
return 24; // Show 24 products per page
} );
