I am overriding private method of model file of checkout module
below is my di.xml file.
<preference for="Magento\Checkout\Model\DefaultConfigProvider" type="Vendor\Module\Model\DefaultConfigProvider" />
An here is my model file.
use Magento\Customer\Api\CustomerRepositoryInterface;
class DefaultConfigProvider extends
\Magento\Checkout\Model\DefaultConfigProvider
{
protected $customerRepository;
public function __construct(
CustomerRepositoryInterface $customerRepository
) {
$this->customerRepository = $customerRepository;
}
private function getCustomerData()
{
$customerData = [];
if ($this->isCustomerLoggedIn()) {
$customer = $this->customerRepository->getById($this->customerSession->getCustomerId());
$customerMasterId = $customer->getMasterId();
$masterCustomer = $this->customerRepository->getById($customerMasterId);
$customerData = $customer->__toArray();
foreach ($masterCustomer->getAddresses() as $key => $address) {
$customerData['addresses'][$key]['inline'] = $this->getCustomerAddressInline($address);
}
}
return $customerData;
}
}
I am not able to override this function since it is private, I did research an found that we need to use plugin method for it, but not found which plugin and how to use in this scenario.
All i am looking is master customer have address so i need to read address from master customer instead of logged customer.
Please anyone suggest me how can i override that method to add my custom logic inside. Thanks in Advance.