public function createOrderFromCart(CartInterface $cart)
    {
        $this
            ->orderEventDispatcher
            ->dispatchOrderPreCreatedEvent(
                $cart
            );

        $order = $cart->getOrder() instanceof OrderInterface
            ? $cart->getOrder()
            : $this->orderFactory->create();

        $cart->setOrder($order);

        $orderLines = $this
            ->cartLineOrderLineTransformer
            ->createOrderLinesByCartLines(
                $order,
                $cart->getCartLines()
            );

        /**
         * @var OrderInterface $order
         */
        $order
            ->setCustomer($cart->getCustomer())
            ->setCart($cart)
            ->setQuantity($cart->getTotalItemNumber())
            ->setPurchasableAmount($cart->getPurchasableAmount())
            ->setShippingAmount($cart->getShippingAmount())
            ->setAmount($cart->getAmount())
            ->setHeight($cart->getHeight())
            ->setWidth($cart->getWidth())
            ->setDepth($cart->getDepth())
            ->setWeight($cart->getWeight())
            ->setBillingAddress($cart->getBillingAddress())
            ->setDeliveryAddress($cart->getDeliveryAddress())
            ->setOrderLines($orderLines);

        $couponAmount = $cart->getCouponAmount();
        if ($couponAmount instanceof MoneyInterface) {
            $order->setCouponAmount($couponAmount);
        }

        $this
            ->orderEventDispatcher
            ->dispatchOrderOnCreatedEvent(
                $cart,
                $order
            );

        return $order;
    }