I've been using some well documented code to programatically create Woocommerce orders. Working great. Reference here: https://quadlayers.com/add-products-woocommerce/
However I'd be keen to know if it's possible to define the order_id (or is that the post_id?) whilst creating my WC orders via a script. I run this code on my shop, which currently imports orders into Woocommerce from a marketplace online where orders already have an Order number and I'd be keen to cut out the cross-referencing via this hack, and pass along the existing Order number to WC.
Here's a rough idea of what I have;
$insert_marketplace_order_id = 1234567890;
$order = wc_create_order();
$order->set_order_id($insert_marketplace_order_id);
$order->set_date_created($date_here);
$order-> etc. etc.
$order->save();
I've obviously searched around, unfortunately the existence of a plugin - which seems to be all Google knows about it - doesn't help.
I would have though 'set_order_id' would do the trick, but perhaps there's an issue with where I'm placing it. Any other ideas?