HUSKY - WooCommerce Product Filter Professional

WooCommerce Filter Pagination Not Working: Causes and Fixes

WooCommerce filter pagination not working usually shows up in one of a few ways: page links that point to /wp-admin/admin-ajax.php?paged=2, a blank page with a single 0, empty pages or a 404 at the end of the filtered results, the filter forgotten on page 2, or an infinite scroll that stops after the first filtering. Each symptom has its own cause, and most of them come from how the theme builds its pagination, not from the filter. Start with the table, then go to the matching section.

What you seeLikely cause
Links to admin-ajax.php?paged=2, blank page with 0AJAX mode with non-standard pagination markup
Two paginations or two "Showing 1–12 of 40" lines after filteringThe theme prints its own elements outside the area HUSKY refreshes
More pages than products, last pages 404 or emptyDifferent "products per page" numbers in HUSKY, the theme and the builder
Empty grid after changing a filter while on page 3The old page number is carried into the new filter link
Filter dead or unstyled after moving to page 2The theme's own AJAX pagination, load more or infinite scroll
Filter missing on page 2, or page 2 shows unfiltered productsFilter placed in page content, or pagination links that drop the filter
No pagination at all after filteringCustom template or theme that prints pagination outside the loop hooks

Links to admin-ajax.php: AJAX mode and theme markup

With Try to ajaxify the shop set to Yes (or [woof_products is_ajax=1] on a page), HUSKY does not reload the page. It asks the server for new products through admin-ajax.php and replaces the product block, pagination included. Because that new pagination is generated inside the AJAX request, its links point to admin-ajax.php?paged=2. They are never meant to be followed: HUSKY catches clicks on .woocommerce-pagination a.page-numbers, reads the page number and loads that page by AJAX.

If the theme changes the pagination markup (a different class on the wrapper, links without the page-numbers class, its own pagination function), the click is not caught and the browser opens the raw link. WordPress answers a request to admin-ajax.php without an action with 0, which is the blank page. The markup HUSKY expects is WooCommerce's own:

<nav class="woocommerce-pagination">
  <ul class="page-numbers">
    <li><span aria-current="page" class="page-numbers current">1</span></li>
    <li><a class="page-numbers" href="https://example.com/shop/page/2/">2</a></li>
    <li><a class="next page-numbers" href="https://example.com/shop/page/2/">&rarr;</a></li>
  </ul>
</nav>

Inspect your pagination in the browser and compare. A theme that overrides woocommerce/loop/pagination.php or uses its own pagination can be fixed in a child theme (even a typo such as woocmmerce-pagination in the wrapper class is enough to break it), but the reliable fix needs no code: switch to redirect mode. Open the plugin settings, tab Options, set Try to ajaxify the shop to No and save; on pages with the shortcode use is_ajax=0. Every filtering then reloads the page, and pagination is the theme's normal pagination. AJAX cannot be switched off for pagination only. See also pagination troubles in AJAX mode.

If the option says it was saved but returns to Yes, Turbo mode is enabled. Turbo mode works only with AJAX and switches the option back on every page load; disable Turbo mode first.

Duplicate pagination or a result count that does not update

Some themes print the result count, sorting or pagination outside the block HUSKY replaces. After AJAX filtering you then see the theme's stale element next to the fresh one, or a count that still describes the unfiltered shop. For the count, enter its selector, usually .woocommerce-result-count, in Advanced → Options → Result count css selector; HUSKY then redraws it after each filtering (Order dropdown css selector does the same for sorting). If duplicates remain, redirect mode removes them.

Extra pages and a 404 at the end of the results

WordPress decides whether /page/7/ exists from the main query of the page: if the main query has six pages, page 7 is a 404, whatever a product grid on that page shows. Problems start when the visible grid and the main query count products per page differently, for example a builder widget showing 30 per page while the main query uses the theme's 12: the pagination and the existing page numbers no longer agree, and pages run empty or end in a 404 halfway through. HUSKY's own setting, Advanced → Options → Products per page, applies only while a filter is active (its default, -1, means "do not manage"), so a mismatch with it appears only after filtering.

  1. Find every place that sets the number: the theme or WooCommerce catalog settings, the builder's products widget, and HUSKY's Products per page.
  2. Set the same number in all of them, or set HUSKY's to -1 so it does not interfere.
  3. Test without the filter: deactivate HUSKY for a moment and open a high page directly, such as /shop/page/17/. If it is a 404 now, the mismatch is between the theme and the builder, not in the filter.

If the page count is still too high only while filtering, the theme probably calculates pagination from a different query; fixing pagination that shows too many pages has a snippet that forces the total from the filtered query. Avada has its own case, described in Avada: filter lost on pagination.

Empty page after changing a filter on page 2 or later

A visitor on page 3 changes a filter. The new result has one page, so if the new link still asks for page 3, the grid is empty or the page is a 404. HUSKY prevents this for standard pagination: it removes /page/N/ and WooCommerce's product-page parameter from the link it builds, and in AJAX mode it resets to page 1 on every change. Other page parameters in the query string are copied into the new link with the rest of the address, for example ?paged=3 on sites with plain permalinks or a page builder's own pagination parameter. Use pretty permalinks (Settings → Permalinks, any structure except Plain) and standard WooCommerce pagination, and check the address after a filter change: it should contain no page number.

Theme AJAX pagination, load more and infinite scroll

Many themes have their own AJAX shop: pagination, "load more" buttons, infinite scroll, AJAX sorting or a grid/list switch that replace the products and the sidebar without reloading. HUSKY initialises its form when the page loads (and after its own AJAX refresh). When the theme swaps in new sidebar HTML, the new filter elements are never initialised, so the filter stops reacting, loses its styling or sends wrong values. A theme's load-more request also builds its own query for "the next page" and does not know about the filter, which is why it can add unfiltered products to a filtered list.

  • Turn off the theme's AJAX pagination, AJAX shop, infinite scroll and load-more options and test with standard pagination. This fixes most cases.
  • For infinite scroll, HUSKY has built-in support for the free YITH Infinite Scrolling plugin: after each AJAX filtering it re-initialises the scroll and corrects the next-page link. Use the selectors listed in infinite scroll for filtered products.
  • Any other script that must restart after AJAX filtering can listen to the woof_ajax_done event, described in the woof_ajax_done event. Which call restarts it depends on that script; ask its author.
/*
 * Runs after every HUSKY AJAX filtering.
 * Put it in a JavaScript file of your child theme.
 */
jQuery(document).on('woof_ajax_done', function () {
    // call the init function of your infinite scroll or load-more script here
});

Instead of a theme file, the body of that function can go into Advanced → Code → JavaScript code after AJAX is done.

Filter missing or forgotten on page 2

  • The filter disappears on page 2. It was placed in the shop page content or in a category description. WooCommerce prints both only on the first page of an archive. Put the filter in a sidebar widget, a theme area that appears on every page, or a builder block outside the description.
  • Page 2 shows unfiltered products. In redirect mode the standard WooCommerce pagination keeps the filter in its links (/shop/page/2/?swoof=1&pa_color=red). Hover a page link: if swoof=1 and your filter values are missing, the theme builds its own links without the query string; switch to standard pagination or fix the theme's link function.
  • Page 2 redirects to the shop or loses the category. Plugins and custom code that rewrite product URLs or archive slugs can conflict with filter links. Test with them disabled; for one known case see HUSKY and Permalinks Manager Pro.

No pagination after filtering

In AJAX mode the refreshed block contains whatever WooCommerce prints on the woocommerce_after_shop_loop hook, and that is where WooCommerce's pagination lives. A theme that removes pagination from that hook and prints its own somewhere else loses it after the first AJAX filtering; redirect mode avoids the problem. If you built your own archive template, print the pagination after the product loop yourself:

<?php
// In your WooCommerce archive template (child theme), after the product loop:
woocommerce_pagination();
?>

A custom template also needs the standard shop loop hooks for AJAX mode to work at all; filter URL changes but products do not change explains which ones.

To bring visitors back to the top of the products after a page change, see auto-scroll after AJAX filtering or, in redirect mode, auto-scroll to products in redirect mode.

Checklist when WooCommerce filter pagination is not working

  • Tested in redirect mode (Try to ajaxify the shop = No, Turbo mode off, is_ajax=0 in shortcodes) after clearing all caches.
  • The pagination markup is nav.woocommerce-pagination with a.page-numbers links.
  • The products-per-page number is the same in the theme, the builder and HUSKY, or HUSKY's is -1.
  • Theme AJAX pagination, load more and infinite scroll are off, or re-initialised on woof_ajax_done.
  • Pagination links on a filtered page contain swoof=1 and the filter values, and no old page number survives a filter change.
  • The filter sits in a sidebar or template area, not in the shop or category description.

If pagination still fails in redirect mode with the theme's standard pagination, open a topic on the HUSKY support forum with the page link and the address of a page that fails.