title: Woocommerce Featured Product by category
body: <p>I am looking for help (thank you) to edit the Woocommerce php widget for 'featured products'.</p>
  <p>The file I think I need to edit is found:</p>
  <pre><code>wp-content/plugins/woocommerce/classes/widgets/class-wc-widget-featured-products.php
  </code></pre>
  <p>The problem:</p>
  <ol>
  <li>Featured products currently display featured products from ALL categories.</li>
  </ol>
  <p>The edit required:</p>
  <ol>
  <li>To only display featured products within the current category being viewed.</li>
  </ol>
  <p>So here is an example:</p>
  <p>I have three categories (dog food, cat food, other stuff).</p>
  <p>Each category has a category homepage:</p>
  <blockquote>
  <p><a href="http://www.mysite.com/dog-food" rel="nofollow noreferrer">www.mysite.com/dog-food</a></p>
  </blockquote>
  <hr />
  <blockquote>
  <p><a href="http://www.mysite.com/catfood" rel="nofollow noreferrer">www.mysite.com/catfood</a></p>
  </blockquote>
  <hr />
  <blockquote>
  <p><a href="http://www.mysite.com/other-stuff" rel="nofollow noreferrer">www.mysite.com/other-stuff</a></p>
  </blockquote>
  <p>When I add a featured products to the 'dog-food' category, the featured product widget also includes featured cat-food products.  Which is useless if the customer does not have a cat.</p>
  <p>I would like featured products widget to display only products that are featured from the current category being viewed - So dog-food customers will only see dog-food featured products (not cat-food or other-things)</p>
  <p>I (think) I need to add an arguement to the PHP file noted above. Here is the current code found within the file:</p>
  <pre><code>$query_args['meta_query'][] = array(
  'key' =&gt; '_featured',
  'value' =&gt; 'yes'
  );
  </code></pre>
  <p>I have tried adding:</p>
  <pre><code>$query_args['meta_query'][] = array(
  'key' =&gt; '_featured',
  'value' =&gt; 'yes',
  'product_cat' =&gt; 'current_category'
  );
  </code></pre>
  <p>But this did not work.</p>