I am using below code to create customer address using customerId
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$addresss = $objectManager->get('\Magento\Customer\Model\AddressFactory');
$address = $addresss->create();
$address->setCustomerId(1256)
->setFirstname('test')
->setLastname('test')
->setCountryId('GB')
->setPostcode('NW p7j')
->setCity('test')
->setTelephone('1232323')
->setStreet('test')
->setIsDefaultBilling('1')
->setSaveInAddressBook('1');
try{
$address->save();
}catch (\Exception $e) {
Zend_Debug::dump($e->getMessage());
}
I have two lines for street, how can i set that? Right now street is storing with one line. also how can we update address if that customer already has any address?