Blog /

WooCommerce: Number of orders per page in My Account – Orders

A short code snippet for editing the number of orders per page in the Order section on My Account page.

Do you need to show more orders per page in the My Account Orders section? You might like the following filter. Use value -1, if you’d like to list all the orders (no pagination at all), or select a number (10, 20…) that will be listed per page.

Add the following code into functions.php of your child template or use a plugin that allows you to add custom snippets such as Code Snippets. Please, do not add snippets directly into your theme template – you will lose changes in the next theme update.


<?php // don't copy this line
/**
* @snippet WooCommerce: My Account Orders Pagination – per page setting
* @source https://kybernaut.cz/?p=2896
* @author Karolína Vyskočilová (https://kybernaut.cz)
* @testedwith WordPress 5.2 & WooCommmerce 3.6.2
*/
// ——————-
function kbnt_my_account_orders( $args ) {
$args['posts_per_page'] = 15; // add number or -1 (display all orderes per page)
return $args;
}
add_filter( 'woocommerce_my_account_my_orders_query', 'kbnt_my_account_orders', 10, 1 );