Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
QuoteCreation.php
Go to the documentation of this file.
1 <?php
7 
12 use Magento\Quote\Model\QuoteFactory;
14 
22 {
26  private $quoteFactory;
27 
32  public function __construct(
33  QuoteFactory $quoteFactory
34  ) {
35  $this->quoteFactory = $quoteFactory;
36  }
37 
49  public function createQuote(
50  Store $store,
54  ): Quote {
55  $quote = $this->quoteFactory->create();
56  $quote->setStoreId($store->getId());
57  $quote->setCustomer($customer->getDataModel());
58  $quote->setCustomerIsGuest(0);
59  $quote->getShippingAddress()
60  ->importCustomerAddressData($shippingAddress->getDataModel());
61  $quote->getBillingAddress()
62  ->importCustomerAddressData($billingAddress->getDataModel());
63  $quote->setInventoryProcessed(false);
64  return $quote;
65  }
66 }
$billingAddress
Definition: order.php:25
$customer
Definition: customers.php:11
createQuote(Store $store, Customer $customer, Address $shippingAddress, Address $billingAddress)
$quote
$shippingAddress
Definition: order.php:40