Skip to content

Instantly share code, notes, and snippets.

  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save vyskoczilova/020a007a191075c2774f87b7ebdf47c8 to your computer and use it in GitHub Desktop.
WooCommerce: My Account Orders Pagination - per page setting
<?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 );
@wpressall
Copy link

wpressall commented Dec 16, 2023

Thanks for sharing, so how can we implement this on the product downloads page? ( .../my-account/my-downloads/ )

@vyskoczilova
Copy link
Author

I don't think it's possible via filter (maybe you could add some logic via JS). I don't use downloads myself, but there is no pagination or querying, it just displays all the downloads, right? This function is responsible for it: https://github.com/woocommerce/woocommerce/blob/bf29119032954313970752372aec1e485a2095c4/plugins/woocommerce/includes/class-wc-customer.php#L228

@wpressall
Copy link

Thank you for your answer. Yes, I did a lot of research to do it through a filter, but unfortunately it is not possible. I did it with datatables js, but I was wondering if there was a simpler way.

@vyskoczilova
Copy link
Author

You're welcome. My fingers crossed with the JS solution.

@florian-hofmann-1977
Copy link

@wpressall Do you have a solution for pagination in my account / downloads ? I would also be very happy to have it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment