title: trigger the update woocommerce product action by code
body: <p>In my site registered users can upload downloadable products in frontend by WPUF,and they can select if the products are free, selecting the value from a dropdown list</p>
  
  <p>I've added this snippet of code in functions.php:</p>
  
  <pre><code>//function to update product status to 'publish'**
  
  // and set the price to 0 for 'free' products**
  
      add_action('wpuf_add_post_after_insert', 'change_post_status');
  
  function change_post_status($post_id){
  
  
     $project_type = get_post_meta($post_id, 'project_type', true);
  
     if ($project_type == 'Free')
      {
  
   update_post_meta( $post_id, '_regular_price', 0);
   $current_post = get_post( $post_id, 'ARRAY_A' );
   $current_post['post_status'] = 'publish';
   wp_update_post($current_post);
  }
  }
  </code></pre>
  
  <p>it seems to work, I can see the product as live after submission, ready to be downloaded , BUT I can't see the products in the woocommerce shop page, and the price (in this case "Free") isn't set. In the product page appears an additional tab "Additional information" that displays the product_cat.
  The only thing that I've noticed in the database is that the metakey product_count_product_cat of wp_woocommerce_termmeta, isn't correctly updated.</p>
  
  <p>To view the product correctly, in the woocommerce page, and in its page, with the correct price (in this case "Free") I need to enter as admin in Products, /edit and click the "Update" button. This solves everything.</p>
  
  <p>Anyone know what function calls the Publish/Update woocommerce Products button?</p>
  
  <p>thank you</p>