module – Magento 2: Create Order Programmatically without products in stock

1. To set the custom order date

After the

$order = $this->quoteManagement->submit($quote);

You can do


to set the order date. And then $this->orderRepository->save($order); to save that new date

$this->orderRepository is an object of MagentoSalesApiOrderRepositoryInterface

2. Custom shipping amount

For the custom shipping amount, it’s a little more complicated. Since you can’t just do $order->setShippingAmount and get away with it. You must also do $order->setBaseShippingAmount, $order->setGrandTotal, $order->setBaseGrandTotal, etc.

A better way would be to write the logic for custom shipping amount in the shipping method itself. You could also write a plugin specific to your scope (frontend, adminhtml, graphql, api_rest, etc.) to apply that custom shipping amount only for that scope.

And then instead of setting freeshipping_freeshipping as the shipping method, set your custom shipping method.

Have a look at THIS to know more about how to create a custom shipping method.