Skip Navigation

[Resolved] WooCommerce Archive ajax filter is not working properly.

This support ticket is created 4 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by Minesh 4 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1619279

Hello,

We have already asked this question in previous thread here

https://toolset.com/forums/topic/archive-ajax-filter-is-not-working-properly/

But that thread is closed by mistake.

We still having same problem on our site.

We are using a ajax filter for archive page.

When we select and deselect between category results are not showing properly.

Select a category -> Will show result for only that category.
Deselect this category and select another category then -> first show result for selected category(second time category) and after one or two second show all result (all filter removed) automatically.

You can see this in following video .
hidden link

At around 0:18 / 0:19 it filters properly and shows one category listings (for a second...)... but then again it shows all the sites

Please help us to solve this.

Thank you.

#1619737

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I shared the feedback on the issue with the previous ticket you created:
=> https://toolset.com/forums/topic/archive-ajax-filter-is-not-working-properly/#post-1603659

The request is handled by the server and it depends on the server how fast/slow the server process the Ajax request. You need to allow to finish the Ajax request.

As you can see with my test server it works OK: hidden link

So, you might consider using some ajax hooks Toolset offers and show/hide your custom search field:
=> https://toolset.com/documentation/programmer-reference/adding-custom-javascript-code-to-views-that-use-ajax/
=> hidden link

Please note that you need to choose the correct JS hook "The custom search has been triggered" and "The custom search results have been updated" and show/hide your element based on the hook triggered. There is no other workaround.

#1619797

Hello Minesh,

When we enable the pagination for the archive, filter starts working fine as expected. If this is a server side problem that server is slow then how it can be works when pagination enabled.

I think there is something else problem that filter is not working properly.

Our server is fast as it need for handing ajax.

Please help us to find and solve this problem.

Thank you

#1619801

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When we enable the pagination for the archive, filter starts working fine as expected. If this is a server side problem that server is slow then how it can be works when pagination enabled.
==>
I think You answer the question yourself. When pagination is enabled you have a few records to fetch and display rather fetching all the records.

There is no workaround I can offer you at the moment other than you need to write your custom jquery code to show/hide the filter based on the trigger of ajax hooks I shared. Even I shared the test site where you see there is no -pagination added and it works as expected: hidden link

As shared, the only workaround could be you should use those ajax hooks to show/hide element based on the ajax action. Like use the hook "The custom search has been triggered" to hide the element and then "The custom search results have been updated" you can show the element again.