title: WooCommerce programmatically created product ignores prices sorting filter
body: <p>I have following function to create new woocommerce product on the frontend.</p>
  <pre><code>parse_str($_POST['form_data'], $form_data);
  $insertPost = array(
      //'ID'          =&gt; $post_id,
      'post_title' =&gt; $form_data['post_title'],
      'post_status' =&gt; $form_data['post_status'],
      'post_type' =&gt; 'product',
      'post_content' =&gt; $form_data['post_content']
  );
  $insert_post = wp_insert_post( $insertPost, true);
  update_post_meta( $insert_post, 'hours', $form_data['hours'] );
  update_post_meta( $insert_post, 'year', $form_data['year'] );
  update_post_meta( $insert_post, '_weight', $form_data['_weight'] );
  update_post_meta( $insert_post, '_price', $form_data['_regular_price'] );
  update_post_meta( $insert_post, '_regular_price', $form_data['_regular_price'] );
  update_post_meta( $insert_post, '_sale_price', $form_data['_sale_price'] );
  update_post_meta( $insert_post, '_stock_status', $form_data['_stock_status'] );
  $term_taxonomy_ids = wp_set_object_terms( $insert_post, array(15), 'product_cat' );
  wp_set_object_terms( $insert_post, 'simple', 'product_type' );
  
  </code></pre>
  <p>The code above is creating a new product and adding all data to it as expected.
  The issue is when using the sort by price filter, the sorting doesn't really sort the newly product created in proper way, it just ignores it.</p>
  <p>After searching i found in WooCommerce &gt; Status &gt; Tools &gt; Product lookup tables (regenerate)
  once i click the regenerate button, then it regenerate all product data and the price sorting is working as expected.</p>
  <p>So what is missing in my function to make the price sorting work without regenerate button?</p>