create(Address::class, ['data' => $addressData[0]]); $shippingAddress->setAddressType('shipping'); $billingAddress = clone $shippingAddress; $billingAddress->setId(null) ->setAddressType('billing'); /** @var Quote $quote */ $quote = $objectManager->create( Quote::class, [ 'data' => [ 'customer_id' => $customer->getId(), 'store_id' => $store->getId(), 'reserved_order_id' => '0000032134', 'is_active' => true, 'is_multishipping' => false ] ] ); $quote->setShippingAddress($shippingAddress) ->setBillingAddress($billingAddress) ->addProduct($product); $quote->getPayment() ->setMethod('checkmo'); $quote->getShippingAddress() ->setShippingMethod('flatrate_flatrate') ->setCollectShippingRates(true); $quote->collectTotals(); /** @var CartRepositoryInterface $repository */ $repository = $objectManager->get(CartRepositoryInterface::class); $repository->save($quote);