title: Woocommerce - search in product category by keyword
body: <p>This is my search form. Im use woocommerce. And need to search products by keywords and categories.</p>
  
  <pre><code>         &lt;form role="search" method="get" action="&lt;?php echo get_permalink( woocommerce_get_page_id( 'shop' ) ); ?&gt;"&gt;
              &lt;div class="search-bar-select hidden-sm hidden-xs"&gt;
                  &lt;span&gt;&lt;/span&gt;
                  &lt;i&gt;&lt;/i&gt;
                  &lt;select name="category"&gt;
                  &lt;option value="" class="search-bar-select-text"&gt;&lt;?php _e('[:ru]Все категории[:ro]Toate categoriile') ?&gt;&lt;/option&gt;
                  &lt;?php foreach(woo_category_list(FALSE) as $category) { ?&gt;
                  &lt;option value="&lt;?php echo $category-&gt;slug; ?&gt;"&gt;&lt;?php echo $category-&gt;cat_name; ?&gt;&lt;/option&gt;
                  &lt;?php } ?&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="search-bar-input"&gt;
                  &lt;input type="text" name="s" value="&lt;?php echo get_search_query(); ?&gt;" placeholder="&lt;?php _e('[:ru]Поиск по сайту ...[:ro]Căutare pe site') ?&gt;" /&gt;
              &lt;/div&gt;
              &lt;input type="hidden" name="post_type" value="product" /&gt;
              &lt;div class="search-bar-btn"&gt;
                  &lt;button type="submit"&gt;&lt;i class="fa fa-search"&gt;&lt;/i&gt;&lt;/button&gt;
              &lt;/div&gt;
          &lt;/form&gt;
  </code></pre>
  
  <p>this is my filter code</p>
  
  <pre><code>function advanced_search_query($query)
  {
  if($query-&gt;is_search()) {
      // category terms search.
      if (isset($_GET['category']) &amp;&amp; !empty($_GET['category'])) {
          $query-&gt;set('tax_query', array(array(
              'taxonomy' =&gt; 'product_cat',
              'field' =&gt; 'slug',
              'terms' =&gt; array($_GET['category']) )
          ));
      }    
      return $query;
  }
  }
  add_action('pre_get_posts', 'advanced_search_query', 1000);
  </code></pre>
  
  <p>but wordpress show all products from all categories by keyword.
  WHAT IS WRONG?</p>