-
Notifications
You must be signed in to change notification settings - Fork 206
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
Pre-fill user info for Link in the Payment Element (classic checkout) #3621
Conversation
ab853ca
to
adb7968
Compare
adb7968
to
af459c3
Compare
isLinkEnabled() && | ||
paymentMethodType === 'card' | ||
) { | ||
if ( document.getElementById( 'billing_email' ) ) { |
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.
Optional: Maybe we could have a specific function to avoid duplicate code? Something like:
function maybeAttachPaymentElementDefaultValueUpdateToBlur( elementId ) {
if ( ! document.getElementById( elementId ) ) {
return;
}
document.getElementById( elementId ).onblur = function () {
updatePaymentElementDefaultValues();
};
}
Not the best name. And I know it is just one almost-duplicated line, but these things tend to grow fast.
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.
Good suggestion! Tidied it up in e2572e0
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.
Nice work! Code is good (left an optional suggestion) and works as described:
Unregistered user
- Check the checkbox. You should see pre-filled email address and phone number fields. See Screenshot 1.
- Verify that you can complete the purchase without any problem.
Registered user
- You should now see your saved credit cards. See Screenshot 3.
- Verify that you can complete the purchase without any problem.
Completes #3619
Changes proposed in this Pull Request:
Similar to #3620 for block checkout, we will pre-fill the email address and phone number fields in the classic (shortcode) checkout, to improve the user experience for Link in the Payment Element.
Testing instructions
Unregistered user
Save your info for secure 1-click checkout with Link
appear.Screenshot 1: Notice how the email address and phone number are pre-filled.
Registered user
Screenshot 2: Notice how the email address is pre-filled.
Screenshot 3: After authentication via challenge code, user's saved credit cards are available for use.
changelog.txt
andreadme.txt
(or does not apply)Post merge