I'm sure there must be a simple way to programatically create a new order from the current checkout data in WooCommerce but I can't find it anywhere.
I have $order = wc_create_order(); $order->update_status('pending', 'order_note');
but I need all products and shipping etc added to the order exactly as it would be if the order was processed. I really just need whatever is on the checkout page processed into an order.
Surely this is a simple command?
Thanks
EDIT:
So I now have added all billing and shipping address details in with a long, laborious process. But now I need the shipping data......
$shipping_total = WC()->cart->get_shipping_total();
$order->set_shipping_total( $shipping_total );
The first line gets the amount but the second line doesn't seem to do anything. I think that I need to add in an entire shipping method to have the order list properly with full shipping info?
Why isn't there a 'Make order from checkout' function?
Thanks