We have implemented a custom payment method, but when anyone update the billing address in payment page of checkout , updated billing address is not reflecting after order got placed.
we used $order = $this->quoteManagement->submit($quote); to place an order and before placing an order we are updating the billing address as below.
if (isset($billingAddress['firstname'])) {
$quote->getBillingAddress()->setFirstname($billingAddress['firstname']);
$quote->getBillingAddress()->setLastname($billingAddress['lastname']);
$quote->getBillingAddress()->setStreet($billingAddress['street']);
$quote->getBillingAddress()->setCity($billingAddress['city']);
$quote->getBillingAddress()->setTelephone($billingAddress['telephone']);
$quote->getBillingAddress()->setPostcode($billingAddress['postcode']);
if(!empty($billingAddress['region'])){
$quote->getBillingAddress()->setRegion($billingAddress['region']);
}else{
$billingAddress['region'] = '';
$quote->getBillingAddress()->setRegion($billingAddress['region']);
}
if (array_key_exists("regionId",$billingAddress))
{
$quote->getBillingAddress()->setRegionId($billingAddress['regionId']);
}else{
$billingAddress['regionId'] = 'NULL';
$quote->getBillingAddress()->setRegionId($billingAddress['regionId']);
}
if (array_key_exists("saveInAddressBook",$billingAddress)){
$quote->getBillingAddress()->setSaveInAddressBook($billingAddress['saveInAddressBook']);
}else{
$billingAddress['saveInAddressBook'] = '0';
$quote->getBillingAddress()->setSaveInAddressBook($billingAddress['saveInAddressBook']);
}
$quote->getBillingAddress()->setCountryId($billingAddress['countryId']);
$quote->save();
}
Can anyone help me with this?