[Resolved] Woocommerce search and product tags

Home Forums Support [Resolved] Woocommerce search and product tags

Home Forums Support Woocommerce search and product tags

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

    Hello,

    I found the answer to the first part of my question in the link below, which was how do I change the search function to respond like the Woocommerce product search. https://generatepress.com/forums/topic/change-search-parameters-in-navigation-menu/

    But I’d also like to have the search produce results for Woocommerce product tags. Currently when I search for a tag, there are no results.

    So specifically, the question is whether the search results can produce both what it’s doing now (I used the code from GitHub in the code snippets plugin) plus tags results?

    Thank you.

    #516086
    Tom
    Lead Developer
    Lead Developer

    This code is actually preferred:

    add_filter( 'generate_navigation_search_output', 'tu_wc_navigation_search' );
    function tu_wc_navigation_search() {
    	printf(
    		'<form method="get" class="search-form navigation-search" action="%1$s">
    			<input type="search" class="search-field" value="%2$s" name="s" title="%2$s">
    			<input type="hidden" name="post_type" value="product">
    		</form>',
    		esc_url( home_url( '/' ) ),
    		esc_attr( get_search_query() ),
    		esc_attr_x( 'Search', 'label', 'generatepress' )
    	);
    }

    As for searching taxonomies, it might be worth checking out a plugin like this: https://wordpress.org/plugins/relevanssi/

    #516440
    Bob

    Thanks Tom, I’ll also check out the link.

    #516532
    Tom
    Lead Developer
    Lead Developer

    No problem! 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.