-
Notifications
You must be signed in to change notification settings - Fork 326
Open
Labels
P0High priorityHigh priorityTeam MIssues for Squad 2Issues for Squad 2Type: BugSomething isn't workingSomething isn't working
Description
Bug Description
When WooCommerce purchases include a phone number that already contains a country code prefix (e.g., +94), Site Kit's Enhanced Conversions implementation adds the country code again programmatically, resulting in a duplicated prefix in the data layer.
Example:
- User enters:
+94771770589 - Data layer outputs:
+9494771770589(country code+94duplicated)
Expected behavior:
If the user-entered phone number already contains a country code prefix, Site Kit should not prepend it again.
Bug Bashing Asana ticket for reference.
Steps to reproduce
Steps to reproduce
- Install and activate WooCommerce
- Enable Site Kit's Enhanced Conversions (ensure
gtagUserDatafeature flag is enabled) - Create a test product in WooCommerce
- Proceed to checkout
- Enter billing information with a phone number that includes the country code, e.g.,
+94771770589 - Complete the purchase
- Inspect the data layer in Tag Assistant
- Observe the
user_data.phone_numberfield shows a duplicated country code:+9494771770589
Additional Scenarios
Scenario 1: Short national number without country code
- Input:
7800099 - Expected:
+447800099(if billing country is UK) - Actual: Phone number doesn't appear in events (fails length validation after normalization)
Scenario 2: User enters a different country code than the billing country
- Input:
+2307800099(Mauritius +230) - Billing Country: UK (which has +44)
- Expected:
+2307800099(respect user's explicit country code) - Actual:
+442307800099(billing country code incorrectly prepended, overriding user's input)
Screenshots
Additional Context
- PHP Version:
- OS: [e.g. iOS]
- Browser: [e.g. chrome, safari]
- Plugin Version: [e.g. 22]
- Device: [e.g. iPhone6]
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Phone numbers entered with a country code prefix (e.g.,
+94771770589) should not have the country code duplicated in the data layer. - Phone numbers entered without a country code prefix (national format) should have the billing country code prepended correctly.
- Phone numbers entered with a different country code than the billing country should respect the user's explicitly provided country code.
- All phone numbers should pass E.164 format validation (11-15 characters including
+).
Implementation Brief
Test Coverage
QA Brief
Changelog entry
Metadata
Metadata
Assignees
Labels
P0High priorityHigh priorityTeam MIssues for Squad 2Issues for Squad 2Type: BugSomething isn't workingSomething isn't working