Woocommerce Search perform “like” query


I have a search box on woocommerce site and it seems to only find products if the searcher enters the keyword exactly

so if they search for Kola bottles it will not find it as the title is “cola bottles”

how can I get the search box to find products if the search query is more general or with spelling mistakes etc… need a “like” query rather than “match”

// custom product search form
add_filter( 'get_product_search_form' , 'me_custom_product_searchform' );
 function me_custom_product_searchform( $form ) {

$form = '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/'  ) ) . '">
  <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'Search for your favourite sweets', 'woocommerce' ) . '" />
  <input type="hidden" name="post_type" value="product" />
        <button type="submit" id="searchsubmit" />
                <span class="icon"><img src="https://www.wptricks.com/wp-content/uploads/2020/08/search-icon.png"></span>
 return $form;
, FoamyMedia 3 years 2020-08-23T04:10:24-05:00 0 Answers 49 views 0

Leave an answer