23 $defaultBillingId =
$customer->getData(
'default_billing');
24 $defaultShippingId =
$customer->getData(
'default_shipping');
29 if (
$address->getId() == $defaultBillingId) {
30 $customer->setData(
'default_billing',
null);
33 if (
$address->getId() == $defaultShippingId) {
34 $customer->setData(
'default_shipping',
null);
37 $removedAddressId =
$address->getId();
41 $customer->getAddressesCollection()->removeItemByKey($removedAddressId);
47 )->setIsCustomerSaveTransaction(
51 if ((
$address->getIsPrimaryBilling() ||
57 if ((
$address->getIsPrimaryShipping() ||
65 $changedAddresses = [];
67 $changedAddresses[
'default_billing'] =
$customer->getData(
'default_billing');
68 $changedAddresses[
'default_shipping'] =
$customer->getData(
'default_shipping');
70 $customer->getResource()->getConnection()->update(
71 $customer->getResource()->getTable(
'customer_entity'),
73 $customer->getResource()->getConnection()->quoteInto(
'entity_id = ?',
$customer->getId())
processRelation(\Magento\Framework\Model\AbstractModel $object)