[Resolved] Show product search in archive/shop page format

Home Forums Support [Resolved] Show product search in archive/shop page format

Home Forums Support Show product search in archive/shop page format

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1181219
    Richard

    Hi!

    I want ask for helo with how the search form shows the result. I want to show all the result (even if it’s only one) in the archive page format, I use the filter:

    add_filter( 'generate_navigation_search_output', function() {
        printf(
            '<form method="get" class="search-form navigation-search" action="%1$s">
                <input type="search" placeholder="Enter your 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' ) 
        ); 
    } );

    But when is only one result, it directly re-direct to the product page and what I want is to show that product on archive page (because my shop doesn’t have product page).

    Thank you for your help!

    #1181658
    Richard

    Some help please?

    #1181908
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Just looked around and found this filter:

    add_filter( 'woocommerce_redirect_single_search_result', '__return_false' );

    Let me know if it helps or not ๐Ÿ™‚

    #1182031
    Richard

    Works perfectly.

    Thank you Tom!

    #1182461
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

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