Site logo

Archived topic

Standard product search results

2 replies · Started by Georgi on April 6, 2022

Viewing posts 1–3 of 3

Hello,

I once found a functions.php code here in the forum that made the product search results the standard way like they look in product category archives but I updated the woocomemrce/the theme on and the function got cleared.

Right now when I search for something products show up but they are with an excerpt which cuts at some point and that's it, there is no buy button - https://prnt.sc/dbLQ-uc8ruQ6

Can you help?

Here's a search word you can try: аметист

I found it:

add_filter( 'generate_navigation_search_output', function() {
    printf(  
        '<form method="get" class="search-form navigation-search" action="%1$s">
            <input type="search" class="search-field" value="%2$s" name="s" title="%3$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' ) 
    ); 
} );

I'm sorry. I searched for 30 minutes before posting this thread and after I posted it, I found it :D

Glad to hear you found it!

This archived topic is closed to new replies.