Website Building » WooCommerce » How Do I Enable Pagination in WooCommerce?

How Do I Enable Pagination in WooCommerce?

Last updated on January 18, 2023 @ 6:55 pm

Pagination is a great way to improve the navigation of your WooCommerce store, and it can be easily enabled with a few clicks. By default, WooCommerce will only display 10 products per page, but you can easily change this setting in the WordPress admin.

To do so, simply go to Settings > Reading and look for the ‘Blog pages show at most’ setting. From here, you can change the number of products that are displayed on each page.

If you want to take things a step further and add some style to your pagination, you can do so by adding some code to your theme’s functions.php file. For example, the following code would add a “first” and “last” link to your pagination:

function wc_pagination_args( $args ) {
  $args['base'] = str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) );
  $args['format'] = '?page=%#%';
  $args['current'] = max( 1, get_query_var('paged') );
  $args['end_size'] = 1;
  $args['mid_size'] = 2;
  $args['prev_next'] = true;
  $args['prev_text'] = __('« First', 'text-domain');
  $args['next_text'] = __('Last »', 'text-domain'); 
  return $args;
}
add_filter('woocommerce_pagination_args', 'wc_pagination_args');

Conclusion:

Pagination is a great way to improve the navigation of your WooCommerce store. You can easily enable pagination in WooCommerce by going to Settings > Reading and changing the Blog pages show at most setting. If you want to add some style to your pagination, you can do so by adding code to your theme’s functions.php file.

PRO TIP: Please be aware that enabling pagination in WooCommerce may result in decreased performance on your website. Additionally, please note that this feature is still in beta and may not work as expected. Use at your own risk.
Kathy McFarland

Kathy McFarland

Devops woman in trade, tech explorer and problem navigator.