Customize WooCommerce Storefront Theme Number of Products Shown

Storefront is a great theme from WooCommerce. Customizing the homepage isn’t so easy. Without using several plugins you’re a little stuck on what you can customize. One of the pieces I found myself wanting to customize was the number of products in each section. Here’s how to customize the number of products shown in the Recent Products section of the homepage. You’ll need to paste the following snippet into theĀ functions.php file of your child theme.

add_filter('storefront_recent_products_args','mf_home_product_per_page', 20 );
function mf_home_product_per_page( $args ) {
<span data-mce-type="bookmark" style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" class="mce_SELRES_start"></span>$args['per_page'] = 8;
$args['limit'] = 8;
return $args;
}

There are 6 total sections on the homepage. You can filter each of them with the following lines appropriately.

add_filter('storefront_recent_products_args','mf_home_product_per_page', 20 ); // Recent Products
add_filter('storefront_featured_products_args','mf_home_product_per_page', 20 ); // Featured Products
add_filter('storefront_popular_products_args','mf_home_product_per_page', 20 ); // Popular Products
add_filter('storefront_on_sale_products_args','mf_home_product_per_page', 20 ); // On Sale Products

Leave a Comment