Company Module in B2B Magento 2 allowed to create a registration for the company user from the storefront in Magneto 2.
Its store configuration setting to enable or disable storefront registration. By default, the B2B module allowed to create a registration from the frontend.
Go To admin panel,
Stores -> Configuration -> Company Configuration -> Allow Company Registration from the Storefront -> Yes/No.
You can check it also using the programmatic way with the use of StatusServiceInterface.
<?php namespace Jesadiya\CompanyRegistration\Model; use Magento\Company\Api\StatusServiceInterface; class CompanyRegistrationEnable { /** * @var StatusServiceInterface */ private $companyRegistrationAllowed; public function __construct( StatusServiceInterface $companyRegistrationAllowed ) { $this->companyRegistrationAllowed = $companyRegistrationAllowed; } /** * Company registration allowed from the store front. * * @return bool */ public function isFrontRegistrationAllowed(): ?bool { $isStorefrontRegistrationAllowed = $this->companyRegistrationAllowed->isStorefrontRegistrationAllowed(); return $isStorefrontRegistrationAllowed; } }
Call method to identify status,
echo $isCompanyActive = $this->isCompanyModuleActive();
If Output is 1, Company module is enable to work with B2B in Magento 2.
Output:
Boolean