title: Update price of a WooCommerce product in PHP
body: <p>I'm trying to change the prices of various products on my <kbd>WooCommerce website</kbd>, but I have a problem. When I run the script, if I change <code>correctly</code> in the database and goals, the front of the web still appears as the wrong prices, even some prices appear "Free".</p>
  
  <p>The strangest thing of all is that by entering the product edition if I see the prices correctly.</p>
  
  <p>I give you the code sample:</p>
  
  <pre><code>$stock          = $value['stock'];
  $regular_price  = $value['rates']['2']['rate_pvp'];
  
  update_post_meta($post_id, '_regular_price',    $regular_price);
  update_post_meta($post_id, '_price',            $regular_price);
  
  $product-&gt;set_price($regular_price);
  
  if($stock&gt;0){
      update_post_meta($post_id, '_stock_status', 'instock');
  } else {
      update_post_meta($post_id, '_stock_status', 'outofstock');
  }
  
  update_post_meta($post_id, '_stock', $stock);
  
  echo $post_id . ':' . $value['variation_sku'] . ':' . $stock . '.............................OK&lt;br/&gt;';
  
  wc_delete_product_transients();
  </code></pre>