PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Quick Search -Only show/count items in stock or on backorder

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Can you suggest an edit to the quick search code to only select products that have stock OR are available on backorder please?

I have edited the index.php of quick search to
if (version_compare(WOOCOMMERCE_VERSION, '3.0', '>=')) {
$tax_query[] = array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => array('exclude-from-catalog','outofstock'),
'operator' => 'NOT IN',
);

But it is still finding out of stock items. For example https://ukhomeshoppingonline.com/search-british-food/
Search for chicken and page 11 shows chicken filets that are out of stock.

So maybe this is a cache issue - the data file creation shows 860 products but the quick search page shows 511 pages of 12 products = 6100 items which was what the original JSON file held before I updated the code.

So any idea hw to defeat the cache?

OK, answered my own question so posting the answer in case it ever helps anyone else :)

The Quick Search uses a JSON data file to provide super fast search results however JSON files are cached by the web browser so if you make any changes to the JSON file by reindexing your products, you will find that the new file is not updated - seems to be about 24 hours until it is refreshed by the browser.
So to check that the changes you have made have been successful, you will need to clear the browser cache and it should then get the updated file.

Hello

Thank you  for  your  cooperation!

To clear browser cache - Ctrl+F5