title: WooCommerce Brand taxonomy terms list in a dropdown selector
body: <p>I do not wish to use any plugin to complete this task as I've experienced conflicts recently with a similar project that broke a site. So I wish to create this functionality from basics.</p>
  <p>I require a dropdown list on the product category pages to select products by Brand. The dropdown list would show all brands. When you select one the site displays only those products assigned to the brand. We do not need to use the built-in dropdown that allows viewing by newness, price, popularity etc.</p>
  <p>Using the WooCommerce <strong><code>'Brands</code></strong>' taxonomy I have set up my brands and allocated each product a <strong>brand</strong>.</p>
  <p>I can view the array of all brands and their attributes with the following code:</p>
  <pre><code>$brands = get_terms('brand');
  print_r($brands);
  </code></pre>
  <p>Which outputs the following:</p>
  <blockquote>
  <p>Array (</p>
  <p>[0] =&gt; WP_Term Object ( [term_id] =&gt; 978 [name] =&gt; Imari Sometsuke [slug] =&gt; imari-sometsuke [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 978 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 1 [filter] =&gt; raw )</p>
  <p>[1] =&gt; WP_Term Object ( [term_id] =&gt; 982 [name] =&gt; Kutani [slug] =&gt; kutani [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 982 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 2 [filter] =&gt; raw )</p>
  <p>[2] =&gt; WP_Term Object ( [term_id] =&gt; 977 [name] =&gt; Kutani Shoza [slug] =&gt; kutani-shoza [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 977 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 4 [filter] =&gt; raw )</p>
  <p>[3] =&gt; WP_Term Object ( [term_id] =&gt; 979 [name] =&gt; Kutani Tokkuri [slug] =&gt; kutani-tokkuri [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 979 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 2 [filter] =&gt; raw )</p>
  <p>[5] =&gt; WP_Term Object ( [term_id] =&gt; 985 [name] =&gt; Nishikawa Sukenobu [slug] =&gt; nishikawa-sukenobu [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 985 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 1 [filter] =&gt; raw )</p>
  <p>[6] =&gt; WP_Term Object ( [term_id] =&gt; 984 [name] =&gt; Shinsui Ito [slug] =&gt; shinsui-ito [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 984 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 2 [filter] =&gt; raw )</p>
  <p>[7] =&gt; WP_Term Object ( [term_id] =&gt; 976 [name] =&gt; Takeji Asano [slug] =&gt; takeji-asano [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 976 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 2 [filter] =&gt; raw )</p>
  <p>[8] =&gt; WP_Term Object ( [term_id] =&gt; 980 [name] =&gt; Toshusai Sharaku [slug] =&gt; toshusai-sharaku [term_group] =&gt; 0 [term_taxonomy_id] =&gt; 980 [taxonomy] =&gt; brand [description] =&gt; [parent] =&gt; 0 [count] =&gt; 3 [filter] =&gt; raw )</p>
  <p>)</p>
  </blockquote>
  <p>How would one go about constructing the dropdown (select) list to create this?
  I imagine it would have the framework something like, which I have started:</p>
  <pre><code>&lt;?php
  $brands = get_terms('brand');
  //print_r($brands);
  ?&gt;
  
  &lt;select name=&quot;orderby&quot; class=&quot;orderby&quot;&gt;
      &lt;?php foreach ( $brands as ??? ) : ?&gt;
          &lt;option value=&quot;&lt;?php echo esc_attr( $??? ); ?&gt;&quot; &lt;?php selected( $orderby, $??? ); ?&gt;&gt;&lt;?php echo esc_html( $??? ); ?&gt;&lt;/option&gt;
      &lt;?php endforeach; ?&gt;
  &lt;/select&gt;
  </code></pre>