Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
quote_with_address.php
Go to the documentation of this file.
1 <?php
7 require __DIR__ . '/../../Customer/_files/customer.php';
8 require __DIR__ . '/../../Customer/_files/customer_address.php';
9 require __DIR__ . '/../../../Magento/Catalog/_files/products.php';
10 
12 
14 $quoteShippingAddress = $objectManager->create(\Magento\Quote\Model\Quote\Address::class);
15 
17 $accountManagement = $objectManager->create(\Magento\Customer\Api\AccountManagementInterface::class);
18 
20 $customerRepository = $objectManager->create(\Magento\Customer\Api\CustomerRepositoryInterface::class);
22 
24 $addressRepository = $objectManager->create(\Magento\Customer\Api\AddressRepositoryInterface::class);
25 $quoteShippingAddress->importCustomerAddressData($addressRepository->getById(1));
26 
28 $quote = $objectManager->create(\Magento\Quote\Model\Quote::class);
29 $quote->setStoreId(
30  1
31 )->setIsActive(
32  true
33 )->setIsMultiShipping(
34  false
35 )->assignCustomerWithAddressChange(
36  $customer
37 )->setShippingAddress(
39 )->setBillingAddress(
41 )->setCheckoutMethod(
42  'customer'
43 )->setPasswordHash(
44  $accountManagement->getPasswordHash('password')
45 )->setReservedOrderId(
46  'test_order_1'
47 )->setCustomerEmail(
49 )->addProduct(
50  $product->load($product->getId()),
51  2
52 );
$objectManager
$addressRepository
defined('TESTS_BP')||define('TESTS_BP' __DIR__
Definition: _bootstrap.php:60
$customerRepository
$accountManagement
$quoteShippingAddress