Skip to content
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

Merged
merged 3 commits into from
Nov 25, 2024

Conversation

annemirasol
Copy link
Contributor

@annemirasol annemirasol commented Nov 21, 2024

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

  1. Enable Link as a payment method.

Unregistered user

  1. As a shopper, add a product to cart and go to classic/shortcode checkout.
  2. Enter your test email address, one that is NOT registered with Link.
  3. Complete shipping/billing details and enter a phone number.
  4. In the Payment Element, after filling in the card number, expiry and CVC, you should see the option Save your info for secure 1-click checkout with Link appear.
  5. Check the checkbox. You should see pre-filled email address and phone number fields. See Screenshot 1.
  6. Verify that you can complete the purchase without any problem.

Screenshot 1: Notice how the email address and phone number are pre-filled.
Screenshot 2024-11-22 at 11 10 43 AM

Registered user

  1. As a shopper, add a product to cart and go to classic/shortcode checkout.
  2. Enter your test email address, one that is registered with Link.
    • You can use the now-registered email address from the previous test.
  3. In the Payment Element, notice your Link-registered email address with challenge code boxes. Since we are in test mode, you may enter any 5-digit number to authenticate. See Screensot 2.
  4. You should now see your saved credit cards. See Screenshot 3.
  5. Verify that you can complete the purchase without any problem.

Screenshot 2: Notice how the email address is pre-filled.
Screenshot 2024-11-22 at 11 13 19 AM

Screenshot 3: After authentication via challenge code, user's saved credit cards are available for use.
Screenshot 2024-11-22 at 11 14 00 AM


  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

Base automatically changed from add/link-pe-integration to develop November 22, 2024 16:11
@annemirasol annemirasol force-pushed the add/link-pe-integration-shortcode branch 2 times, most recently from ab853ca to adb7968 Compare November 22, 2024 16:47
@annemirasol annemirasol self-assigned this Nov 22, 2024
@annemirasol annemirasol force-pushed the add/link-pe-integration-shortcode branch from adb7968 to af459c3 Compare November 22, 2024 17:38
@annemirasol annemirasol marked this pull request as ready for review November 22, 2024 17:43
@annemirasol annemirasol requested review from a team and wjrosa and removed request for a team November 22, 2024 17:51
isLinkEnabled() &&
paymentMethodType === 'card'
) {
if ( document.getElementById( 'billing_email' ) ) {
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@wjrosa wjrosa left a 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

  1. Check the checkbox. You should see pre-filled email address and phone number fields. See Screenshot 1.

Screenshot 2024-11-22 at 16 44 31

  1. Verify that you can complete the purchase without any problem.

Screenshot 2024-11-22 at 16 59 47

Registered user

  1. You should now see your saved credit cards. See Screenshot 3.

Screenshot 2024-11-22 at 17 01 59

  1. Verify that you can complete the purchase without any problem.

Screenshot 2024-11-22 at 17 02 46

@annemirasol annemirasol merged commit 99cabe3 into develop Nov 25, 2024
34 of 35 checks passed
@annemirasol annemirasol deleted the add/link-pe-integration-shortcode branch November 25, 2024 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants