Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Aug 28, 2025

Description

More information in this PR: #16055

WCAnalyticsCustomer and Customer are tightly coupled in the app. We mostly see Storage.Customer created from WCAnalyticsCustomer after fetching data from wc-analytics/customer and then additionally fetching data from /customers/{userID} if additional data could be loaded from the registered user.

WCAnalyticsCustomer contains both customerID (unique ID for customer that has made an order), and userID (unique ID for a registered user on the WP site).

However Storage.Customer only contains customerID which sometimes is set to WCAnalyticsCustomer.userID value which makes codebase around customers hard to grasp.

I tried to disambiguate and explicitly use userID or customerID when needed:

  • Added userID to Customer entity with new model and migration tests
  • Updated Customer mapping to set both userID and customerID
  • Went through usages and used one or another where appropriate

Steps to reproduce

TBD: I still need extensive testing

Testing information

Screenshots


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

staskus added 11 commits August 28, 2025 23:59
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)
@dangermattic
Copy link
Collaborator

2 Warnings
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
1 Message
📖 This PR is still a Draft: some checks will be skipped.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Aug 28, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16056-62ec3c5
Version23.1
Bundle IDcom.automattic.alpha.woocommerce
Commit62ec3c5
Installation URL09m2t4n6lqeb0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot wpmobilebot modified the milestones: 23.2, 23.3 Sep 5, 2025
@wpmobilebot
Copy link
Collaborator

Version 23.2 has now entered code-freeze, so the milestone of this PR has been updated to 23.3.

@iangmaia iangmaia modified the milestones: 23.3, 23.4 Sep 19, 2025
@iangmaia
Copy link
Contributor

Version 23.3 has now entered code-freeze, so the milestone of this PR has been updated to 23.4.

@staskus staskus modified the milestones: 23.4, 23.5 Oct 3, 2025
@wpmobilebot wpmobilebot modified the milestones: 23.5, 23.6 Oct 17, 2025
@wpmobilebot
Copy link
Collaborator

Version 23.5 has now entered code-freeze, so the milestone of this PR has been updated to 23.6.

@staskus staskus closed this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants