Edit: Ok, I have checked the issue further. It happens even quicker. You just need to visit the home page (search is working), go to a product page (search is working), go back to the home page and the search is not working anymore. I had to disable page caching for now as it seems to block ajax requests somehow or is caching them and then they don’t work anymore.
Hello @beats247
I am sorry about the issue you are experiencing and I am happy to assist you with this.
Can you please share which Page Cache method you are using? Also, Is the option Cache URIs with query string variables enabled in Performance>Page Cache?
Can you please re-enable Page Cache and try disabling Browser Cache, save all settings and purge the cache and see if the issue persists? If the issue is still there, possibly the expires header for js files may be causing this.
Thanks!
Hey @vmarko,
thanks for your reply. I am using “Disk:enhanced” for Page caching. The caching option for query strings variables is not enabled, it is even greyed out.
When enabling Page cache again and disabling Browser Cache, the issue still persists. If the expires header for js files is causing this, what do I need to change then? Thanks again!
Hello @beats247
If the issue was still there once BC was disabled then the issue is not related to expires header set.
have you tried adding the /?wc-ajax=martfury_search_products to page exclusion in Performance>Page Cache>Advanced> Never cache the following pages:
Thanks!
Hello @vmarko,
I have tested it and added it to excluded but when I open the site in inkognito browser mode the search function isn’t working anymore (error 403). It not only blocks the ajax search function, also the modal product popups loaded with ajax (product reviews) and also the ajax sales notification popups (at least on first load).
I added these ajax requests to the excluded list from page caching
/?wc-ajax=martfury_search_products
/?wc-ajax=martfury_product_quick_view
However, it seems like it doesn’t have any influence although everything is working fine when I disable page caching entirely.
Thanks again!
Edit: What’s really odd is that the trigger is always going back to the home page again. You can visit every other page twice without breaking it, only going back to the home page causes this issue. That’s why I excluded the front page from page caching now which seems to work? It’s not an ideal solution though. The issue with the non-working popup remains on first load on all other cached pages.
Never mind, even disabling page caching for the front/home page doesn’t help. On the long run there are 403 errors for ajax actions on product pages as well. I have to deactivate it completely, unfortunately 🙁
Hello @beats247
Thank you for the info. Can you please share what you’ve had to deactivate completely?
Thanks!
Hi @vmarko,
I had to deactivate page caching from your plugin completely as excluding the front page in your page cache settings (“Don’t cache the front page”) didn’t entirely solve the problem. It seems like this isn’t working together with the ajax features of the site somehow.
The issue is not “resolved”, but thanks anyway.
Hello @beats247
Sorry about this. I was taking care of multiple topics.
Anyway, let’s re-cap.
Calling ajax requests is used to bypass the cache.
– You stated that the issue happens when Page Cache is enabled.
– You also started that you are using the Disk: Enhanced caching method.
– When Page Cache is disabled the issue is gone.
Now please understand that we cannot test the plugin with all the themes out there and their functions.
This is also the first time I am seeing this kind of issue and I cannot think of the reason why would page cache disable search on any page and especially the front page. By simple logic, it may be a minify issue.
Be that as it may, you may want to try switching the caching method to Disk: Basic and see if the issue persists.
Have you tried reaching out to the support of the theme you are using and as about the compatibility issues with any caching plugins?
Thanks!