Site logo

Archived topic

Product count & pagination using Facetwp

3 replies · Started by Juan Manuel on May 16, 2020

Viewing posts 1–4 of 4

Hi,

I am struggling to make facetwp to work properly in my product category pages. Filters seem to work properly, but since facetwp works in ajax, pagination and product count (ie showing X from Y products) get broken, as they don't get updated.

In facetwp documentation, I found this and also this for those cases where you are using archive pages (my case), where they point out that the "facetwp-template" class could be added to the listing to fix this.

And that's where I am stuck. I don't see any place to add this in GeneratePress, and it feels wrong to try to add that in Woocommerce plugin.

Any idea on how to fix it?

Edit: I also found these 2, they look great, but old, idk if they are trustworthy.

https://sridharkatakam.com/facetwp-woocommerce-genesis/
https://gist.github.com/djrmom/2bd924a9db5e61b85b222d2d16d649a0

Also, thanks a lot for your wonderful support (found a lot of answers in this forum) and theme, and congrats for the 6 years :)

Hi there,

The solutions you've found looks ok to me.

Maybe give them a shot and see if that works for you?

If not you might need to check with the plugin support to see if they can provide explanations in better details.

Hi Leo,

Thanks for your answer.

Just in case someone needs it in the future, this fixed it:

// Removes default WooCommerce pagination.
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination' );

add_action( 'woocommerce_after_shop_loop', 'custom_woocommerce_pagination' );
//Adds FacetWP's pagination on WooCommerce archives.
function custom_woocommerce_pagination() {
    echo facetwp_display( 'pager' );
}

That fixes the pagination, the rest (product sorting and count) can be fixed the same way by just using different actions and pushing the appropriate facet.

Best regards,

Glad to hear and thanks for sharing :)

This archived topic is closed to new replies.