Site icon Hip-Hop Website Design and Development

add image url programatically

I have this code to make a new product programatically, all is working perfectly, however is missing to add the front image to it, anyone can help?

if(isset($_POST['create_new'])){
  global $wpdb;
  $product = new WC_Product_Simple();
  $product->set_name("new product");
  $product->set_status( 'publish' );
  $product->set_catalog_visibility( 'visible' );
  $product->set_category_ids([23]);
  $product->set_description("the product description");
  $product->set_regular_price(55.99);
  $product->set_manage_stock(1);
  $product->set_stock(30);
  $product->save();
}