title: How to directly update WooCommerce product stock quantity by its sku
body: <p>A have a ton of variable products. I'm using cron to run the script every X minutes for fetching stock level from an external source. If I use <code>wc_get_product_id_by_sku</code> and <code>update_post_meta</code> it takes too long so I'm trying to find the way to use a custom prepared query.
  If I know <code>product_id</code> query would be like that:</p>
  <pre><code>$conn-&gt;prepare( &quot;UPDATE wp_postmeta SET meta_value=? WHERE post_id=? AND meta_key=`_stock`&quot; );
  </code></pre>
  <p>But I only know a product SKU. So how to modify this query to update <code>_stock</code> based on a product SKU?</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>post_id</th>
  <th>meta_key</th>
  <th>meta_value</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>10</td>
  <td>_sku</td>
  <td>ABCD</td>
  </tr>
  <tr>
  <td>10</td>
  <td>_stock</td>
  <td>25</td>
  </tr>
  </tbody>
  </table>
  </div>