// Generate an order number if none was provided. Doing it after validation since
// the generation of the order number cannot be reverted in a simple manner.
if($order->getNumber() === null){ $orderNumberGenerator = Shopware()->Container()->get(NumberRangeIncrementerInterface::class); $orderNumber = $orderNumberGenerator->increment('invoice');