-
Notifications
You must be signed in to change notification settings - Fork 119
Customer and WCAnalyticsCustomer: Disambiguate userID and customerID
#16056
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
Customer and WCAnalyticsCustomer: Disambiguate userID and customerID
#16056
Conversation
Customer and WCAnalyticsCustomer are used in the app together to facilitate order creation and customer management. customerID on Customer object was sometimes overwritten by userID from WCAnalyticsCustomer making it ambiguous which one is used at what time.
When updating Storage.Customer from WCAnalyticsCustomer map both customerID and userID so they could be both used directly and unambiguously when needed
Networking.Customer is used for both WCAnalyticsCustomer and Customer use cases. Since WCAnalyticsCustomer contains both userID and customerID, we need Customer to contain both so data wouldn't be lost in the conversion
Customer filter in orders doesn't work for non-registered users (that don't have userID set)
Generated by 🚫 Danger |
|
|
|
Version |
|
Version |
|
Version |

Description
More information in this PR: #16055
WCAnalyticsCustomerandCustomerare tightly coupled in the app. We mostly seeStorage.Customercreated fromWCAnalyticsCustomerafter fetching data fromwc-analytics/customerand then additionally fetching data from/customers/{userID}if additional data could be loaded from the registered user.WCAnalyticsCustomercontains bothcustomerID(unique ID for customer that has made an order), anduserID(unique ID for a registered user on the WP site).However
Storage.Customeronly containscustomerIDwhich sometimes is set to WCAnalyticsCustomer.userID value which makes codebase around customers hard to grasp.I tried to disambiguate and explicitly use
userIDorcustomerIDwhen needed:userIDtoCustomerentity with new model and migration testsuserIDandcustomerIDSteps to reproduce
TBD: I still need extensive testing
Testing information
Screenshots
RELEASE-NOTES.txtif necessary.