0

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

1

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.

1

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>';
        }
}
  • 1
    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. – creativeone Aug 17 '18 at 12:48
0

Add below code in file functions.php:

remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
  • 1
    Thanks . But I wanted to use custom layout. – Mostafa Norzade Feb 12 at 6:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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