Get company by customer Id in Magento 2 B2B.

Magento Commerce has a native B2B feature. If you are using B2B feature for your store from Magento Commerce, You can get a list of a company for your store from the Back end by Navigating to Customer -> Companies

You can check your assigned company by Customer dashboard,

Go To Customer -> All Customer
Now click on Account Information Tab,
Check Associate to Company Value. That’s your company associated with Customer Account.

Magento\Company\Api\CompanyManagementInterface Interface will be used for getting a Company data by Customer id.

You can get Company Collection programmatically by below way,

class YourClass {
    public function __construct(
        \Magento\Company\Api\CompanyManagementInterface $companyRepository
    ) {
        $this->companyRepository = $companyRepository;

    public function getCustomerCompany()
        $companyId = 10;
        $company = $this->companyRepository->getByCustomerId($companyId);
        return $company;

Get a list of company information from a template file,

$getCompany = $this->getCustomerCompany();
foreach($getCompany as $company) {
    echo $company->getCompanyName();echo "<br>";
    echo $company->getLegalName();echo "<br>";
    echo $company->getCompanyEmail();echo "<br>";
    echo $company->getCity();echo "<br>";
    echo $company->getTelephone();echo "<br>";