Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
customer_two_addresses.php
Go to the documentation of this file.
1 <?php
10 
11 require 'customer_address.php';
12 
15  ->create(\Magento\Customer\Model\Address::class);
18  ->get(CustomerRegistry::class);
19 $customerAddress->isObjectNew(true);
20 $customerAddress->setData(
21  [
22  'entity_id' => 2,
23  'attribute_set_id' => 2,
24  'telephone' => 3234676,
25  'postcode' => 47676,
26  'country_id' => 'US',
27  'city' => 'CityX',
28  'street' => ['Black str, 48'],
29  'lastname' => 'Smith',
30  'firstname' => 'John',
31  'parent_id' => 1,
32  'region_id' => 1,
33  ]
34 )->setCustomerId(
35  1
36 );
37 
38 $customerAddress->save();
39 $customerRegistry->remove($customerAddress->getCustomerId());