So i have a wordpress woocommerce site and I would like to add a button under the pagenumbers (do you call this pagination?) so the user can select himself how many products to view per page, ie 20, 40, 80 etc.

I would like it to be at the bottom under the page numbers, I have tried a solution that leaves the drop down at the top, near where it says "Showing products 1-20.." not quite where I want it.

Any ideas? point me to a thread or tutorial on this?

Thanks for reading!


example i like https://www.funko.com/shop (see bottom)

  • Include some code, show us what you've tried, what works and where... ...if you can get it to show up at the top then it should just be a matter of finding the correct hook to use to get it show up at the bottom. Jul 9, 2020 at 16:01
  • Hi Tony, here is a link to what I tried and it kind of worked. stackoverflow.com/a/55292815
    – Mikebb
    Jul 9, 2020 at 18:12

1 Answer 1


If I'm understanding your comment properly, then the solution is quite simple. In the StackOverflow answer you have this line right at the top:

add_action( 'woocommerce_before_shop_loop', 'ps_selectbox', 25 );

What that line does is take the function you created (ps_selectbox) and it hooks it into the woocommerce_before_shop_loop action hook. WooCommerce is littered with these action hooks, specifically for this purpose, so that we can add in our own functions and changes without having to edit their core code.

So if the only issue you're looking to address with the answer from StackOverflow (https://stackoverflow.com/a/55292815) is to change where the dropdown appears, then you just need to change the first line:

add_action( 'woocommerce_after_shop_loop', 'ps_selectbox', 5 );

There's two things changed there. 1) I changed the action to woocommerce_after_shop_loop, this will make it appear below the products. 2) I changed the priority number of the add_action to 5 instead of 25.

I changed the priority number because if we go and look at the default archive-product.php template that comes bundled as part of WooCommerce, we see this:

 * Hook: woocommerce_after_shop_loop.
 * @hooked woocommerce_pagination - 10
do_action( 'woocommerce_after_shop_loop' );

In the comments it's telling us that woocommerce_pagination is being hooked into this same action (by WooCommerce) with a priority of 10.

So by adding your function ps_selectbox at 5 it's coming BEFORE the built in WooCommerce pagination.

If you want it to come after the woocommerce pagination, you'd change your priority value to 15 or 20. You decide if you want to jump in increments of 5 or 10.

If you look through the archive-product.php you'll notice that all of the action hooks list other functions that are already being hooked into them and the priority is spaced by 10s, like so:

 * Hook: woocommerce_before_shop_loop.
 * @hooked woocommerce_output_all_notices - 10
 * @hooked woocommerce_result_count - 20
 * @hooked woocommerce_catalog_ordering - 30

This is done intentionally by WooCommerce so that you/other developers, can wedge their own functions in between the default WooCommerce ones. They leave 9 spots between function hooked for you to hook your own.

  • Thank you! this worked, I learnt a little bit more with your solution :)
    – Mikebb
    Jul 13, 2020 at 16:11
  • Please accept this as the answer so that other users know this is the correct answer. Just click the checkmark under the up/down vote arrows. Jul 13, 2020 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.