Magento 2 Get Customer's Telephone after registration

Viewed 3412

I am new to Magento2 and I was wondering if someone could help me echo out Customer's Address information in an activation email to Admin. Below is the code I am using to build the Customer's information.

->setTemplateVars(
            [
                'email' => $customer->getEmail(),
                'firstname' => $customer->getFirstname(),
                'lastname' => $customer->getLastname(),
                'company' => $customer->getAddress()->getCompany(), //DOESN'T WORK!!
                'telephone' => $customer->getAddress()->getTelephone(), //DOESN'T WORK!!
                'taxvat' => $customer->getTaxvat(),
                'website' => $customer->getCustomAttribute('website')->getValue(),
            ]
        );

Email, Firstname, Lastname, TaxVat and Custom Attribute "Website" are all working and showing properly on my email. However, I can't get the information for Company Name, Telephone, Address, etc.

I would appreciate it if anyone could help point me in the right direction.

1 Answers
Related