Skip to content

Commit 8604be9

Browse files
committed
Resolve Customer sent newsletter unsubscribe email when registering for a new account and newsletter confirmation is on issue 23729
1 parent dc2e73a commit 8604be9

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

app/code/Magento/Customer/Controller/Account/CreatePost.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,14 @@ public function execute()
349349
$confirmation = $this->getRequest()->getParam('password_confirmation');
350350
$redirectUrl = $this->session->getBeforeAuthUrl();
351351
$this->checkPasswordConfirmation($password, $confirmation);
352+
353+
$extensionAttributes = $customer->getExtensionAttributes();
354+
$extensionAttributes->setIsSubscribed($this->getRequest()->getParam('is_subscribed', false));
355+
$customer->setExtensionAttributes($extensionAttributes);
356+
352357
$customer = $this->accountManagement
353358
->createAccount($customer, $password, $redirectUrl);
354359

355-
if ($this->getRequest()->getParam('is_subscribed', false)) {
356-
$extensionAttributes = $customer->getExtensionAttributes();
357-
$extensionAttributes->setIsSubscribed(true);
358-
$customer->setExtensionAttributes($extensionAttributes);
359-
$this->customerRepository->save($customer);
360-
}
361360
$this->_eventManager->dispatch(
362361
'customer_register_success',
363362
['account_controller' => $this, 'customer' => $customer]

0 commit comments

Comments
 (0)