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

Redirection to WooPay Not Triggering on Shortcode Checkout Pages #8398

Closed
rafaelzaleski opened this issue Mar 15, 2024 · 12 comments · Fixed by #8777
Closed

Redirection to WooPay Not Triggering on Shortcode Checkout Pages #8398

rafaelzaleski opened this issue Mar 15, 2024 · 12 comments · Fixed by #8777
Assignees
Labels
category: core WC Payments core related issues, where it’s obvious. component: WooPay WooPay related issues focus: woopay priority: medium The issue/PR is medium priority—non-critical functionality loss, minimal effect on usability type: bug The issue is a confirmed bug.

Comments

@rafaelzaleski
Copy link
Contributor

Describe the bug

Users with matching WooPay email addresses are not automatically redirected to WooPay during the checkout process on stores using shortcode checkout pages. This issue arose after implementing a new precondition check for WooPayments activation within the shop (see #8116). The core of the problem lies in the reliance on the wc/store/payment store, which only is working within the checkout block context, returning an empty object in shortcode checkouts. This results in the redirection condition failing (hasWCPayPaymentMethod = false).

To Reproduce

Prerequisites:

  • WooPayments and WooPay are enabled.
  • The customer is logged into WooPay.
  • The customer uses an email address for billing that matches their WooPay account.
  • A page with the checkout shortcode.
  1. Add a product to the cart.
  2. Proceed to the shortcode checkout page.
  3. Notice the absence of redirection to WooPay and the email field not initiating an email check (no loading spinner displayed).

Actual behavior

The expected behavior of redirecting to WooPay or displaying the OTP authentication iframe does not occur upon page load.

Screenshots

Screen.Recording.2024-03-15.at.10.54.56.mov

Expected behavior

To maintain compatibility with shortcode checkouts, an alternative method to verify WooPayments activation in the shop, applicable outside the checkout block context, is required.

@rafaelzaleski rafaelzaleski added the type: bug The issue is a confirmed bug. label Mar 15, 2024
@rafaelzaleski rafaelzaleski added the component: WooPay WooPay related issues label Mar 15, 2024
@zmaglica zmaglica added category: core WC Payments core related issues, where it’s obvious. focus: woopay labels Mar 18, 2024
@pierorocca
Copy link
Contributor

Doesn't look intentional, however, we are moving away from the auto-redirect as part of the Direct Checkout project. The only use case that will remain that triggers the OTP modal is a signed out shopper that manually enters the email address.

@pierorocca pierorocca added the priority: medium The issue/PR is medium priority—non-critical functionality loss, minimal effect on usability label Mar 21, 2024
@pierorocca
Copy link
Contributor

@bborman22 worth working on this one? As part of Direct Checkout I had wanted the auto-redirect to be suppressed and for the OTP to only display when the shopper is manually keying in the email address. However it sounds like this was achieved unintentionally?

@bborman22
Copy link
Contributor

@asumaran I was thinking this issue could be a good one to pick up as you get into some of the Direct Checkout work. To summarize, the original bug listed is actually very close to how we want it to operate and this issue can be repurposed to confirm the following:

  • The auto redirect that uses login-session request is only fired if the shopper just manually entered their email address.
  • The OTP modal is only fired if the shopper just manually entered their email address.
  • This should apply to both shortcode and blocks.
  • The email address may be pre-populated if: 1) the shopper is logged into the merchant store, 2) the shopper has recently checked out or started a checkout and entered their email address. In both of these scenarios, the auto redirect and the OTP modal should NOT be displayed.

This issue will likely involve some removal of code (like calls to openLoginSessionIframe that happen outside of an input change event).

@asumaran
Copy link
Contributor

@bborman22 Thanks. I'll take a look at this.

@pierorocca
Copy link
Contributor

@asumaran the thinking is that since Direct Checkout now gets signed in shoppers to WooPay directly, that leaves non-WooPay shoppers and signed out shoppers to address. For signed-out WooPay shoppers, if the form field is pre-filled or they've used autofill, eliminating the on-page load OTP is less intrusive. And we want to respect shopper choice by not trying to force them to sign-in so aggressively. Fine balance. Thanks for picking this up.

@asumaran
Copy link
Contributor

asumaran commented May 3, 2024

@bborman22 @pierorocca If a signed in shopper go to the checkout page and the email is populated it shouldn't redirect to WooPay right? If they type their WooPay email it should open the OTP page or should be redirected automatically given that they are already signed in on WooPay?

@pierorocca
Copy link
Contributor

Correct. Once we enable direct checkout for all merchants signed in shoppers shouldn't get to store checkout page with the exception of being in Hosted Checkout and clicking "alternative payment methods". The idea is to prevent the redirect on page load as it's an aggressive experience

@asumaran
Copy link
Contributor

asumaran commented May 3, 2024

@pierorocca just to double check. We shouldn't redirect only if the direct checkout feature is enabled for the site?

If the feature is disabled, we should redirect the user (if the email is already present) on page load just like before?

Or should we remove the auto redirect completely?

@pierorocca
Copy link
Contributor

pierorocca commented May 3, 2024

Good question. Let's remove the auto-redirect completely. Doesn't make sense for a shopper to have checkout loaded and then be redirected to another checkout.

@bborman22
Copy link
Contributor

Let's remove the auto-redirect completely.

Just to be clear, we'll be removing all auto-redirects from checkout page even if the shopper entered their email on checkout (not pre-populated)?

@pierorocca
Copy link
Contributor

pierorocca commented May 6, 2024

@bborman22 removing all on page load auto-redirects. The redirects related to entering an email, post page load, remain.

@asumaran
Copy link
Contributor

asumaran commented May 6, 2024

removing all on page load auto-redirects. The redirects related to entering an email, post page load, remain.

Yes, that's right. I am only removing the automatic redirect when the page loads. Those already logged into WooPay will still be redirected after manually entering a valid WooPay email. cc @bborman22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: core WC Payments core related issues, where it’s obvious. component: WooPay WooPay related issues focus: woopay priority: medium The issue/PR is medium priority—non-critical functionality loss, minimal effect on usability type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants