Forums › Forums › Search & Filter Pro › Woocommerce default pagination with ajax not working
Tagged: pagination ajax woocommerce
- This topic has 6 replies, 2 voices, and was last updated 4 years, 5 months ago by
Anonymous.
-
Anonymous(Private) December 11, 2020 at 9:47 am #269520
Hallo,
We’re using the default Woocommerce templates and set S&F Display results to Woocommerce. We’re trying to use load the results with Ajax but the Woocommerce pagination is not updating. I’ve set the Pagination selector to .woocommerce-pagination a
Code for pagination:
$total = isset( $total ) ? $total : wc_get_loop_prop( 'total_pages' ); $current = isset( $current ) ? $current : wc_get_loop_prop( 'sf_paged' ); $base = isset( $base ) ? $base : esc_url_raw( str_replace( 999999999, '%#%', remove_query_arg( 'add-to-cart', get_pagenum_link( 999999999, false ) ) ) ); $format = isset( $format ) ? $format : ''; if ( $total <= 1 ) { return; } ?> <section class="woocommerce-pagination pb-5 pb-md-75 bg-grey"> <div class="container-xl"> <nav> <?php echo paginate_links( apply_filters( 'woocommerce_pagination_args', array( // WPCS: XSS ok. 'base' => $base, 'format' => $format, 'add_args' => false, 'current' => max( 1, $current ), 'total' => $total, 'prev_text' => '←', 'next_text' => '→', 'type' => 'list', 'end_size' => 3, 'mid_size' => 3, ) ) ); ?> </nav> </div> </section>
Code output: as seen on: https://otaking.tv/the-otaku-shop/
Trevor(Private) December 11, 2020 at 10:47 am #269540What Ajax Container are you using?
I would try either:
.products
OR#shop
The issue with the latter is that it also includes the filter form, which is not always a good thing to do.
The problem is that there is not a container in the template that holds just the products and the pagination, so, if you are able to edit the template, add a div around those two sections, or maybe move the pagination in to the same section as the products and give that section a custom class?
-
AuthorPosts