Search box in menubar wordpress using Customizr Theme woocommerce

Hello Guys Im trying to put a search box in my menubar and I was able to do it BUT how can I use the woocommerce search product instead??

heres my current Code in the function.php:

Read More
add_filter( 'wp_nav_menu_items','add_search_box', 10, 2 );
function add_search_box( $items, $args ) {
$items .= '<li>' . get_search_form( false ) . '</li>';
    return $items;
}

I want to put Woocommerce_product_search in my MENUBAR anybody can help me.

SOrry for the ENglish im really not good in it.

Related posts

Leave a Reply

1 comment

  1. Register a Sidebar in your Functions.php and then add the sidebar into your container where you want the search box to appear. Then add the Woocommerce Search Widget to this sidebar inside the WordPress Admin interface.

    Add this to Functions.php:

    register_sidebar(array(
          'id' => 'search-widget',
          'name' => __('Search Widget'),
          'description' => __('Drag search widget to this container'),
          'before_widget' => '<article id="%1$s" class="widget %2$s">',
          'after_widget' => '</article>',
          'before_title' => '<h6>',
          'after_title' => '</h6>'      
      ));
    }
    

    Add this to your Header.php or whichever file contains the code where the search box needs to go:

    <?php dynamic_sidebar("search-widget"); ?>