1

how can I remove default pagination on woocommerce shop page ? and then use my custom pagination (or use pagination plugin) on woocommerce shop page

thank you

4 Answers 4

5

Add below code in file functions.php:

remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
2
  • 1
    Thanks . But I wanted to use custom layout. Commented Feb 12, 2019 at 6:14
  • Didn't work for me Commented Sep 19, 2022 at 2:02
2

You need to locate the right file in the plugins/woocommerce/templates directory and make a woocommerce directory in your theme or child theme and copy it there, and edit it to your liking.

Or you could find the action that puts it there in the first place and remove it with remove_action in your theme-s functions.php.

2

I found the answer :

1) remove woocommerce pagination in theme functions.php :

remove_action( 'woocommerce_before_shop_loop', 'storefront_woocommerce_pagination', 30 );

storefront woocommerce template hooks

2) use the below code for customize your pagination in functions.php :

    function bittersweet_pagination() {

global $wp_query;

$big = 999999999; // need an unlikely integer

$pages = paginate_links( array(
        'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $wp_query->max_num_pages,
        'type'  => 'array',
    ) );
    if( is_array( $pages ) ) {
        $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
        echo '<div class="pagination-wrap"><ul class="pagination">';
        foreach ( $pages as $page ) {
                echo "<li>$page</li>";
        }
       echo '</ul></div>';
        }
}
2
  • 2
    Well this works if you have Storefront...not so much if you're using other themes. Notice that 'storefront_woocommerce_pagination' refers to the WooCommerce Storefront theme. If someone uses this and doesn't put their theme there instead of Storefront it won't work. Commented Aug 17, 2018 at 12:48
  • This also did not work for me Commented Sep 19, 2022 at 2:02
0

This page on the WooCommerce website gave a better answer for me than anything answers on this page: https://woocommerce.com/document/change-number-of-products-displayed-per-page/

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.