• Hello I want to use your product search to replace my current one as it doesnt search deep enough. Thing is a long time ago I added some code in the functions.php to have the position of the search box in the upper right. So i guess I have to add your shortcode here? But I am a bit struggling how to make that work

    this is my current search bar setup.

    So does this has to be altered into Advance woo search for it to make it work by adding echo do_shortcode(?'[aws_search_form]' ); in it?

    Hope someone can help me. Thank you in advance.

    //* POSITION THE PRODUCT SEARCH BUTTON TO UPPER RIGHT *//

    add_filter( 'wp_nav_menu_items', 'wpstudio_add_woo_search', 10, 2 );

    function wpstudio_add_woo_search( $menu, $args ) {

    //* Change 'primary' to 'secondary' to add the woocommerce search to the secondary navigation menu
    if ( 'secondary' !== $args->theme_location )
    return $menu;

    $form = '<form role="search" method="get" id="searchform" action="' . esc_url( home_url( '/' ) ) . '">
    <input type="text" value="' . get_search_query() . '" name="s" id="s" placeholder="' . __( 'Search for products', 'woocommerce' ) . '" />
    <input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search', 'woocommerce' ) .'" />
    <input type="hidden" name="post_type" value="product" />
    </form>';

    $menu .= '<li class="search right">' . $form . '</li>';

    return $menu;

    }
Viewing 1 replies (of 1 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Please try to replace your current code with this one:

    add_filter( 'wp_nav_menu_items', 'wpstudio_add_woo_search', 10, 2 );

    function wpstudio_add_woo_search( $menu, $args ) {

    //* Change 'primary' to 'secondary' to add the woocommerce search to the secondary navigation menu
    if ( 'secondary' !== $args->theme_location )
    return $menu;

    $form = do_shortcode( '[aws_search_form]' );

    $menu .= '<li class="search right">' . $form . '</li>';

    return $menu;

    }

    Regards

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.