Skip to content
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

Deprecate email as an attribute on the Order element #3201

Merged
merged 2 commits into from
Jul 17, 2023

Conversation

nfourtythree
Copy link
Contributor

Description

Currently Commerce is needlessly duplicating data into the email column for the order element. As all customers are now user elements (either credentialed or inactive) the email for the order can be taken directly from this.

This is the first part of a two step process to remove email as an actual attribute on the Order element. In this step it is simply to tidy up the code around emails and deprecate the setEmail() on the element. The second part, likely to be in Commerce 5, will be to remove the email column entirely from the orders database table.

With setEmail() now being deprecated it is advised to switch any code using the method to use setCustomer along with the ensureUserByEmail() method from Craft's user service.

@nfourtythree nfourtythree self-assigned this Jun 22, 2023
@nfourtythree nfourtythree marked this pull request as ready for review June 22, 2023 10:23
@nfourtythree nfourtythree requested a review from a team as a code owner June 22, 2023 10:23
if (!$email) {
$this->_customer = null;
$this->_customerId = null;
$this->_email = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to clear the this->_email ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where have you seen that, I can't see it in the code?

# Conflicts:
#	CHANGELOG.md
#	src/services/Customers.php
@lukeholder lukeholder merged commit 8468b5d into 4.3 Jul 17, 2023
8 checks passed
@lukeholder lukeholder deleted the bugfix/email-property-on-order branch July 17, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants