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

Text searching two words only displaying single posts with both words

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.

Hi there.

I'm trying to get the basic text search to work with two words (or more) but, when I do, the results only display if both words are in the same product.

I need two word searches to show any product with either of the words.

 

So, if i search for 'red' as well as 'rocket' I need it to show any post with 'red' but without 'rocket' as well as any post with 'rocket' but without 'red' as well as any post with both.

Currently it only displays posts with both 'red' and 'rocket' in a single product. If there aren't any products with both words, I get 'no products found' when i know there are products with 'red' and other products with 'rocket'

Is this possible? Seem like it should work but isn't

 

Thanks in advance

Hello

Please  try  to add  in functions.php

add_filter('woof_text_search_like_option', function($if){

return true;

});

And  in  file - \wp-content\plugins\woocommerce-products-filter\ext\by_text\index.php - change  code - https://c2n.me/4bGWUIz.png

Hi. Thanks very much for this. It works perfectly : )

But, is there a way to add this 'OR' behaviour without editing the core plug-in file so this isn't lost with an update?

I was hoping the 'behaviour' dropdown in woo/settings/product filter/structure/search by text/additional options/behaviour would do this? Maybe this could be added?

Thanks for your time.

Hello

But, is there a way to add this 'OR' behaviour without editing the core plug-in file so this isn't lost with an update? - Unfortunately yes

You  can try  to use  this  hook  - https://products-filter.com/hook/woof_text_search_query/ - To replace AND to OR in a search string