Update WooCommerce product price periodically

I’m going to go with Plan B, as above. The reason being that I don’t want the price being potentially manipulated by using JS in the browser. Also, I have no idea how to set the price with JS from the browser!

The plan is have a cron job periodically run a script which loops through products and update_post_meta() on each. Something like:

<?php
$args = array(
  'post_type' => 'product',
  'posts_per_page' => -1
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
  while ( $loop->have_posts() ) : $loop->the_post();
    global $product;

    $value = 840;

    update_post_meta($product->get_id(), '_regular_price', (float)$value);
    update_post_meta($product->get_id(), '_price', (float)$value);

  endwhile;
}
wp_reset_query();

The only question marks which remain are that of performance, but I’m all out of ideas. If anyone can see anything I may have missed, please do chime in!