-
Notifications
You must be signed in to change notification settings - Fork 217
Use more data to build Stripe customer details #4719
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
base: develop
Are you sure you want to change the base?
Use more data to build Stripe customer details #4719
Conversation
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.
Pull Request Overview
This PR enhances the Stripe customer data building logic to use multiple data sources in a hierarchical fashion. Instead of relying solely on WordPress user data or billing fields, the updated logic now checks user data first, then WooCommerce customer data, and finally falls back to submitted billing data to create a comprehensive customer profile for Stripe.
- Updated
generate_customer_request()
method to use a composite data approach across multiple sources - Added new
get_wc_customer()
method to access WooCommerce customer object - Refactored address field generation into a separate helper method for better maintainability
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
includes/class-wc-stripe-customer.php | Enhanced customer data building logic with hierarchical data source fallbacks and new helper methods |
tests/phpunit/WC_Stripe_Customer_Test.php | Added comprehensive test coverage for the new customer request generation logic |
readme.txt | Updated changelog entry for the customer data building fix |
changelog.txt | Added changelog entry documenting the enhancement |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
} | ||
|
||
/** | ||
* Get the current WooCommerce customer object. |
Copilot
AI
Oct 10, 2025
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.
Missing @return annotation for the method. Should include @return WC_Customer|null
to document the return type.
* Get the current WooCommerce customer object. | |
* Get the current WooCommerce customer object. | |
* | |
* @return WC_Customer|null |
Copilot uses AI. Check for mistakes.
if ( null === $value ) { | ||
$value = ''; | ||
} |
Copilot
AI
Oct 10, 2025
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.
The condition null === $value
will never be true. get_user_meta()
with $single = true
returns an empty string for non-existent meta keys, not null. This check should be removed or changed to check for empty string.
if ( null === $value ) { | |
$value = ''; | |
} |
Copilot uses AI. Check for mistakes.
Fixes STRIPE-727
Fixes #4697
Changes proposed in this Pull Request:
This PR updates the logic for building Stripe customer data to look at multiple sources, including the WooCommerce customer object. The PR also changes the logic to build a composite set of data across sources. I am not sure if that is the best idea -- it may be better to simply use the WC_Customer instance instead of the current user.
Testing instructions
Changelog entry
Changelog Entry Comment
Comment
Post merge