WooCommerce Custom Pagination Format

Viewed 528

Need some help from woocommerce gurus here. As currently my site product pagination is display as PREVPAGE 1 2 3 .. 15 NEXTPAGE

May I know how I can make it as FIRSTPAGE PREVPAGE 12345 NEXTPAGE LASTPAGE ? I'm trying to achieve it same as https://www.tourneau.com/certified-pre-owned-watches/#sz=30&start=60

Can it be done just from woocommerce_pagination filter? Any insight?

This is the current code to display the pagination:

<nav class="pagination-cubic">
<?php woocommerce_result_count();?>
    <?php
        echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
            'base'         => esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) ),
            'format'       => '',
            'current'      => max( 1, get_query_var( 'paged' ) ),
            'total'        => $wp_query->max_num_pages,
            'prev_text'    => '<i class="fa fa-angle-left"></i>',
            'next_text'    => '<i class="fa fa-angle-right"></i>',
            'type'         => 'list',
            'end_size'     => 1,
            'mid_size'     => 4
        ) ) );
    ?>
</nav>
1 Answers

You can make it work with WooCommerce by installing the WP-PageNavi plugin and use the following snippet to display the pagination after the shop loop.

add_action( 'woocommerce_after_shop_loop', function () {
        wp_pagenavi();      
    }, 10);

Also use this CSS to hide the default WooCommerce pagination:

.woocommerce nav.woocommerce-pagination {
    display:none;
} 
Related