0

I have set all information in quote but how can i submit ?

$quote->getBillingAddress()->addData($addressData);
$quote->getShippingAddress()->addData($addressData);
//Set Shipping Method
$quote->setShippingMethod('carriers_flatrate');
$quote->setPaymentMethod('cashondelivery');
//Set Payment method
$quote->getPayment()->importData( array('method' => 'cashondelivery'));

// Inventory will not update
$quote->setInventoryProcessed(true);
$quote->save();
$quote->getShippingAddress()->setCollectShippingRates(true);
$quote->getShippingAddress()->collectShippingRates();
$quote->collectTotals();
$quote->save();
$quote->setCustomerEmail('[email protected]');
$quoteManagement = $this->_objectManager->create('\Magento\Quote\Api\CartManagementInterface');

$order = $quoteManagement->submit($quote, ['increment_id' => '100000001']);
0

1 Answer 1

0

I have some suggestions for you, you find all function necessary to submit quote in app/code/Magento/Quote/Model/QuoteManagement.php.

This model implements and override by app/code/Magento/Quote/Api/CartManagementInterface.php in app/code/Magento/Quote/etc/di.xml

4
  • Why we need to override ? Dec 9, 2015 at 6:35
  • Yes this code is running $quoteManagement = $this->_objectManager->create('\Magento\Quote\Model\QuoteManagement'); $order = $quoteManagement->submit($quote); Dec 9, 2015 at 8:53
  • Is it working ?
    – LinoPham
    Dec 9, 2015 at 9:03
  • Yes . This code creating a order in backend Dec 9, 2015 at 9:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.