How to search using product tags within the live search

This topic has 10 replies, 2 voices, and was last updated 2 years, 10 months ago ago by Olga Barlow

  • Avatar: freerunner
    freerunner
    Participant
    January 6, 2022 at 00:19

    Is there any way to setup searching by product tags with the live search?

    9 Answers
    Avatar: freerunner
    freerunner
    Participant
    January 6, 2022 at 03:21

    I DO see that searching for product tags has been added and completed within the Taskboard here: https://www.screencast.com/t/lTvofWT7o5sP
    But I do not see an option for this anywhere within the theme customization tools. Please advise.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 6, 2022 at 15:14

    Hello,

    Full-width search comes with the tags section https://prnt.sc/2693src

    Regards

    Avatar: freerunner
    freerunner
    Participant
    January 6, 2022 at 18:39

    Hi Olga,

    I do see that option. However, the live search does not show results for product tags. For example, my product has a tag named “t-shirt” and I have that tag listed in the tags section within the live search, but when I click on the tag “t-shirt” no products are found. Is there any known way to add product tag searching to your live search bar?

    Thank you

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 10, 2022 at 10:54

    Hello,

    Nope, we don’t have such an option for the search input, unfortunately. It requires additional customization or use a third-party plugin to implement such search.

    Regards

    Avatar: freerunner
    freerunner
    Participant
    January 11, 2022 at 07:38

    Hi Olga,

    Is there anyway that you can help me implement the Relevanssi search plugin into the theme’s live search plugin so that users can search product tags. I have added the Relevanssi search plugin and setup the queries and it appears that the plugin is working for the search, but not the live search. I did a search on the comments section and it looks like someone else was able to get it setup here: https://www.screencast.com/t/7IZ7k2YPsU but I cannot seem to get it working. This is the plugins knowledge base https://www.relevanssi.com/category/knowledge-base/ Do you have any knowledge of how to get this functioning with your theme? Thank you for your time.

    Please contact administrator
    for this information.
    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 11, 2022 at 17:46

    Hello,

    Does that plugin have the search widget or search form shortcode with the live search? In this case, you’ll be able to replace our search element with the plugin shortcode using the HTML block element.

    Regards

    Avatar: freerunner
    freerunner
    Participant
    January 11, 2022 at 18:32

    Hi Olga,

    Actually, Relevanssi creates a custom search index and replaces the internal WordPress search. So what I am trying to do is turn off the XStore search queries/index within your live search and allow Relevanssi to provide the search queries with its index instead. I hope this makes sense.

    Avatar: freerunner
    freerunner
    Participant
    January 12, 2022 at 09:56

    So I reached out to the Relevanssi plugin developer and he has strived to make his plugin compatible with all of the big themes, and he is interested in making compatible with your theme as well.

    The plugin developer provide this code for me to enter into functions.php and it allowed me to add WooCommers Product and Product Taxonomies (i.e. Product Tags, Variations, etc.) to your themes Live Search:

    add_filter( ‘etheme_ajax_search_products_query’, function( $args ) {
    $args[‘relevanssi’] = true;
    return $args;
    } );

    He said that in order to make all other Post Types and Taxonomies to be compatable with your theme is for you to simply add a filter hook to the post search, it’d be one line of code, and then it would be easy to make that search use Relevanssi indexing queries.

    The plugin developer provided this: “Could you please add a filter for the get_posts() arguments in
    get_posts_results() in class-ajax-search.php, matching the etheme_ajax_search_products_query filter in get_products_results()?”

    This would allow the users of your theme to use Relevanssi for searching Product Tags and any other Post Type and custom Taxonomy as they see fit, and the plugin is free to do all of this. They have a premium version, but this is not necessary for the Post Types I have mentioned.

    Please let me know if this can be accommodated? Thank you for your time.

    Avatar: Olga Barlow
    Olga Barlow
    Support staff
    January 12, 2022 at 14:40

    Hello,

    I passed your request to our developers. They will add etheme_ajax_search_posts_query filter in the next theme update.

    Regards

  • Viewing 10 results - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.