-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Admin Order - Email is Now Required - Magento 2.3 #22648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin Order - Email is Now Required - Magento 2.3 #22648
Conversation
Hi @solwininfotech. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@magento-engcom-team give me test instance |
Hi @solwininfotech. Thank you for your request. I'm working on Magento instance for you |
Hi @solwininfotech, here is your new Magento instance. |
Approving this one. Basically, this PR reverts the fix provided in b1eece2#diff-b79fbcef70631d52e90840aaf9a0d94d . This fix results in confusion since the email auto-generation upon guest order creation from admin panel were considered as a useful feature. And the fix prevents store owners from using the expected behavior. Check the original issue for details. |
Hi @rogyar, thank you for the review. |
Hello @solwininfotech, @trucatchtraps, @rogyar @driskell Thank you for contribution and collaboration! Unfortunately, these changes will not be approved by Magento internal team. Changes from b1eece2 were made by the Core team intentionally. But after reading all argumentation from issue description #22251 So, after several internal discussion, I propose the next solution that should cover both cases: ❗ NOTE:
"It should be a configurable option in Configuration" with next requirements:
When option set to "No" Magento should work as it was before b1eece2 |
@sdzhepa Got your point, we will add the settings in the configuration, thank you for your feedback. |
@sdzhepa, I have updated the code. |
@magento-engcom-team give me test instance |
Hi @solwininfotech. Thank you for your request. I'm working on Magento instance for you |
Hi @solwininfotech, here is your new Magento instance. |
@magento-engcom-team |
@solwininfotech |
@sidolov , Thank you for reviewing this thread let me know I need to update in this. |
@magento-cicd2 unfortunately, only members of the maintainers team are allowed to unassign developers from the pull request |
I finally was able to remove the required * for the email address with a custom module. But now when I try to place an order without an email address, I receive the following errors. The value of attribute "Email" must be set |
@magento-engcom-team give me test instance |
Hi @solwininfotech. Thank you for your request. I'm working on Magento instance for you |
Hi @solwininfotech, here is your new Magento instance. |
Changes in this branch will be more helpful to you because of this code does not has an error [The value of attribute "Email" must be set Validation is failed.] as well as it has an admin setting that allows you to add an order with or without a customer email address . Click here for more details. Thank you. |
@@ -39,6 +39,8 @@ class Account extends AbstractForm | |||
*/ | |||
protected $_extensibleDataObjectConverter; | |||
|
|||
const XML_PATH_EMAIL_REQUIRED_CREATE_ORDER = 'customer/create_account/email_required_create_order'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, make constant private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a PHPDOC too
* | ||
* @return bool | ||
*/ | ||
public function isEmailRequiredCreateOrder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, make method private
@@ -33,6 +33,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ | |||
*/ | |||
const XML_PATH_DEFAULT_EMAIL_DOMAIN = 'customer/create_account/email_domain'; | |||
|
|||
const XML_PATH_EMAIL_REQUIRED_CREATE_ORDER = 'customer/create_account/email_required_create_order'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, make constant private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Judging by the current code not obeying such practice I would suggest that change be made in a separate PR aimed at resolving this in the entire class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having said that - I notice the PHPDOC is missing for this constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driskell we can't make existing constants as private due to backward compatibility, but the new one should be private.
@@ -2029,7 +2030,30 @@ protected function _validate() | |||
*/ | |||
protected function _getNewCustomerEmail() | |||
{ | |||
return $this->getData('account/email'); | |||
$email_required = $this->_scopeConfig->getValue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, avoid underscore in the variable naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, this isn’t obeyed by the remaining code and likely require refactor of unrelated code, and so would increase scope of the PR. I’d suggest to pick this up in a separate PR that resolves this for all properties in the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driskell it's not a big deal to rename variables in the modern IDE, it requires an additional commit to make code style better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be a problem that it is protected and not private? I worry further change here might delay the PR merge due to unrelated opportunistic change. As it stands I’m happy to help with the other changes but this one feels like it needs a little more thought and a separately considered and reversible changeset so this feature isn’t lost should an issue be raised.
@@ -33,6 +33,7 @@ class Create extends \Magento\Framework\DataObject implements \Magento\Checkout\ | |||
*/ | |||
const XML_PATH_DEFAULT_EMAIL_DOMAIN = 'customer/create_account/email_domain'; | |||
|
|||
const XML_PATH_EMAIL_REQUIRED_CREATE_ORDER = 'customer/create_account/email_required_create_order'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driskell we can't make existing constants as private due to backward compatibility, but the new one should be private.
@@ -2029,7 +2030,30 @@ protected function _validate() | |||
*/ | |||
protected function _getNewCustomerEmail() | |||
{ | |||
return $this->getData('account/email'); | |||
$email_required = $this->_scopeConfig->getValue( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@driskell it's not a big deal to rename variables in the modern IDE, it requires an additional commit to make code style better.
Thank you for updated, I am working on this. |
@solwininfotech , I am closing this PR now due to inactivity. |
Hi @solwininfotech, thank you for your contribution! |
So will these changes be implemented in a new version? |
Hi @sidolov Thank you. |
Description (*)
Fixed Issues (if relevant)
Manual testing scenarios (*)
Before Fix:



Customer Email is required in Admin Order Creation.
After fixed Customer Email is not required in Admin Order Creation and once order is created customer email will be created automatically by system.
Contribution checklist (*)