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
Add below code in file functions.php
:
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
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.
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>';
}
}
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/