Disabling accounts switch for Business on Behalf

Edit on GitHub

The functionality that allows you to disable switching between the Business-on-Behalf accounts. E.g., if the user logs in to the pre-defined company account that has the Business on Behalf feature integrated, the shop owner can disable the ability to switch between the accounts. In case Business on Behalf is disabled, the company user logs in to the default account and is unable to switch between the company users within their company account.

To disable switching between Business-on-Behalf accounts

  • Introduce a plugin that implements this interface—CompanyUserChangeAllowedCheckPluginInterface:
public function check(CustomerTransfer $customerTransfer): bool
    return false;
  • Add the introduced plugin to Pyz\Client\BusinessOnBehalf\BusinessOnBehalfDependencyProvider::getCompanyUserChangeAllowedCheckPlugins():
protected function getCompanyUserChangeAllowedCheckPlugins(): array
    return [
        new ...Plugin(),