Home Forums WoodMart support forum Product Search Issue in Woodmart Theme

Product Search Issue in Woodmart Theme

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #714159

    bonus
    Participant

    When using the default product search in the Woodmart theme, I noticed the following behavior:

    If I enter a search term consisting of multiple words (e.g., “red leather bag”), the search results only return products that contain all words in the exact order as typed.
    If a user skips a word and types, for example, “red bag” (skipping “leather”), the search returns no results, even though relevant products exist.
    This limitation reduces the relevance of search results and makes it harder for users to find products.

    Expected Behavior:
    The search should return products containing all entered words, regardless of their order, and ideally support partial matches.

    #714224

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Please deactivate all the 3rd party plugins and activate only theme-required plugins on the site and then check the issue. I am sure your issue will be solved. Then Activate the 3rd party plugins one by one and check which plugin is creating the issue for you.

    Otherwise, if the issue still exists then keep the 3rd party plugins deactivated and share the WP admin login details of your site so I will check and give you a possible solution.

    Best Regards.

    #714486

    bonus
    Participant

    After testing, I confirmed that this behavior is not caused by plugins or custom code, but rather by the default WordPress/WooCommerce search logic, which relies on LIKE queries and matches exact phrases instead of individual words.

    To resolve this, I implemented a custom solution:

    Added a FULLTEXT index to the wp_posts table (post_title, post_content)
    Modified the search query using the posts_search filter to use MATCH … AGAINST

    This allows the search to match individual words regardless of order, and now queries correctly return the search.

    My question is:
    Is there any plan to support FULLTEXT search or improve word-based matching in future Woodmart updates, especially for AJAX search? It would greatly improve the search experience for WooCommerce stores with larger product catalogs.

    Thanks in advance!

    My code in functions.php:

    add_filter(‘posts_search’, ‘use_fulltext_search’, 20, 2);

    function use_fulltext_search($search, $wp_query) {
    global $wpdb;

    if (empty($wp_query->query_vars[‘s’])) {
    return $search;
    }

    $search_term = esc_sql($wp_query->query_vars[‘s’]);

    return ” AND MATCH({$wpdb->posts}.post_title, {$wpdb->posts}.post_content)
    AGAINST(‘{$search_term}’ IN NATURAL LANGUAGE MODE)”;
    }

    #714521

    Aizaz Imtiaz Awan
    Keymaster
    Xtemos team

    Hello,

    Currently, WoodMart does not provide an option for this. Such modification requires complicated WooCommerce code customization, which is not covered by our support.

    Best Regards

Viewing 4 posts - 1 through 4 (of 4 total)