Skip to content

Commit 25c4e11

Browse files
AnujNehraAnujNehra
authored andcommitted
ACP2E-2212: Exception Error when trying to change Website in Customer > Company in Admin
1 parent 357ca7c commit 25c4e11

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -923,11 +923,11 @@ public function createAccountWithPasswordHash(CustomerInterface $customer, $hash
923923
// Make sure we have a storeId to associate this customer with.
924924
if (!$customer->getStoreId()) {
925925
if ($customer->getWebsiteId()) {
926+
$storeId = null;
926927
$website = $this->storeManager->getWebsite($customer->getWebsiteId());
927-
if ($website->getDefaultStore() === null) {
928-
throw new InputException(__('Store and store view is required for this website.'));
928+
if ($website->getDefaultStore()) {
929+
$storeId = $website->getDefaultStore()->getId();
929930
}
930-
$storeId = $website->getDefaultStore()->getId();
931931
} else {
932932
$this->storeManager->setCurrentStore(null);
933933
$storeId = $this->storeManager->getStore()->getId();

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,12 +2601,12 @@ public function testValidateCustomerStoreIdByWebsiteIdException(): void
26012601

26022602
/**
26032603
* @return void
2604-
* @throws InputException
2604+
* @throws LocalizedException
26052605
*/
26062606
public function testCompanyAdminWebsiteDoesNotHaveStore(): void
26072607
{
2608-
$this->expectException(InputException::class);
2609-
$this->expectExceptionMessage('Store and store view is required for this website.');
2608+
$this->expectException(LocalizedException::class);
2609+
$this->expectExceptionMessage('The store view is not in the associated website.');
26102610

26112611
$websiteId = 1;
26122612
$customerId = 1;
@@ -2617,7 +2617,7 @@ public function testCompanyAdminWebsiteDoesNotHaveStore(): void
26172617
->disableOriginalConstructor()
26182618
->getMock();
26192619
$website->method('getStoreIds')
2620-
->willReturn([1, 2, 3]);
2620+
->willReturn([]);
26212621
$website->expects($this->atMost(1))
26222622
->method('getDefaultStore')
26232623
->willReturn(null);

0 commit comments

Comments
 (0)