WC Filters not working

Gavin G. asked 8 years ago

I understood that the Performance Plug-in didn't change the URL filters that WC uses.

However, now I have installed the plug-in, the filters no longer work.

For example, http://shop.getoutwiththekids.co.uk/?filtering=1&filter_height=200 or http://shop.getoutwiththekids.co.uk/?filter_brand=vango.

After finding this problem, I updated the settings to drop the BTree Indexes, set 'Enable category/attribute widget SQL cache' to Disabled and 'Disable WooCommerce widget code' to Keep, but unfortunately it didn't resolve the problem.

The only way to restore my site's functionality was to de-activate the plug-in.

Any ideas?

Dave H. replied 8 years ago

Sorry – where column 4 says WooCommerce, not Core

Dave H. replied 8 years ago

Ok – can you give me a login or paste a copy here of what SQL query is being run for WP_Query->get_posts()? Click Query Monitor bar, click Queries, CTRL+F, enter WP_Query->get_posts(), then find the entry where the column to the right of WP_Query->get_posts() says Core (4th column). Copy/paste the query from the 2nd column.

Gavin G. replied 8 years ago

Query Monitor is already installed. Filter query returns nothing.

Dave H. replied 8 years ago

Hi – can you provide a login so I can install Query Monitor and test this for a few minutes to see what’s happening? Also – by ‘no longer work’ – do you mean the filters return everything or return nothing? (to provide a log in, create a private answer on this page)

1 Answers
Dave H. answered 8 years ago

For some reason, wp_query is adding AND (1=0) to the query. This normally happens when the tax queries don’t make sense, so i’ll investigate that further.

In the meantime, I’ve made a slight modification to the code on your site to disable the modification to the tax query when you have the ‘keep’ option enabled.

I highly recommend you switch from the WooCommerce widgets to the WPI widgets however – you will get much better performance.

From the page you linked, I’m seeing a 7 second page load – about 2 seconds of this is DB queries, the remaining 5 seconds PHP processing. You’ll find both these drop significantly if you switch to the WPI widgets. It should only take you a few minutes to replace them.

Note: When you replace the Woo widgets with the WPI widgets, be sure to visit the WPI settings page again and change from ‘keep’ to remove.

The other settings – the indexes etc, I have enabled again as they don’t impact this woo compatibility issue.

Other than altering your widgets, the biggest speed improvement you can make to your site – and it will be BIG – will be to upgrade from PHP 5.3 to PHP 7. Even an upgrade to PHP 5.4 would make a big difference for you as it included major performance enhancements.

PHP 5.3 was released in 2009 and is no longer officially supported. Your hosting company should be able to help you here. I’m in the processing of writing a step-by-step guide detailing how to migrate from any host over to Digital Ocean with Server Pilot – the size of your site would survive easily on a $5pcm Digital Ocean server – I’m not sure how much you’re paying right now, but having a 7-year old version of PHP processing your pages is really not helping your performance.


Gavin G. replied 8 years ago

Thanks Dave.

I just switched the WC Brand Filter to the WPI filter. Unfortunately, clicking on a brand returns no results using the WPI filter.
Also, I noticed that you are filtering on term id whereas WC appears to use value/slug? Correct?
The reason I ask is that I have links elsewhere that point to filtered results and so need to know if I will need to change them once WPI plug-in is up and running.

Also, the Full Text Index is not providing partial results in search (see the separate question I raised).

My main site is now upgraded to PHP7 but this subdomain hasn’t switched and I have an outstanding support ticket on it.
I have been looking at your fast stack on Digital Ocean and migrating to that is something I’m considering.

Your Answer

Super Speedy Plugins