Skip to content

Conversation

AlexP11223
Copy link
Collaborator

Now preserving the customer id in the order if the user was logged in when starting the checkout. That is we started checkout in a non-default browser logged in as user1, and finished in the default browser as a guest, the order will belong to user1.

The log-in prompt after the redirect to the default browser as a guest is disabled.

There is one a bit weird edge, when logged in as different users in both browsers. For now just using the user from the default browser to avoid confusion like going to My Account after the payment and not seeing the order. Maybe a better approach could be to force logout in the default browser. Anyway, hopefully this happens very rarely.

Also I added the woocommerce_order_email_verification_required filter handler to skip email prompt for such orders. It should not be needed in most cases because it is already skipped if the order was created less than 10 minutes ago, but probably a good idea to add that, e.g. if AppSwitch failed and finishing a bit later via another method.

Copy link

github-actions bot commented Aug 26, 2025

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

🔗 Test this pull request with WordPress Playground

What's included:

  • ✅ WordPress (latest)
  • ✅ WooCommerce (latest)
  • ✅ PayPal Payments plugin v3.0.9-pr3613-17467849478-g3e6c4bf (built from this PR)

Login credentials:

  • Username: admin
  • Password: password

Plugin Details:

  • Version: 3.0.9-pr3613-17467849478-g3e6c4bf
  • Commit: 3e6c4bf
  • Artifact: woocommerce-paypal-payments-3.0.9-pr3613-17467849478-g3e6c4bf

💡 The demo environment resets each time you refresh. Perfect for testing!

🔄 This link updates automatically with each new commit to the PR.

⚠️ This URL is valid for 30 days from when this comment was last updated.


🤖 Auto-generated for commit 3e6c4bf • Last updated: 2025-09-04T15:00:52.391Z

Copy link
Collaborator

@Narek13 Narek13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. Left a small suggestion which doesn't prevent me from approving.

*
* @psalm-suppress MissingClosureParamType
*/
add_filter(
Copy link
Collaborator

@hmouhtar hmouhtar Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppSwitch flows are short-lived. If the email prompt is already disabled for orders that were created within the last 10 minutes, I think that's enough, and I don't see much value in extending the support timeframe compared to the side effects that removing this prompt might have, since essentially all orders would be marked with CROSS_BROWSER_APPSWITCH_META_KEY. I'm not even sure AppSwitch will work 10 minutes after it was triggered, so I would recommend removing this.

Not a blocker anyway, thanks for working on this @AlexP11223

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I encountered it some time ago, though not sure how. It can be useful not for AppSwitch itself but when it fails and the customer retries using different methods.

essentially all orders would be marked

all orders? 🤔 Only cross-browser are supposed to be marked, which should be quite rare.

Base automatically changed from PCP-4992-cross-browser-appswitch to develop September 3, 2025 07:18
@Dinamiko Dinamiko merged commit de21bfe into develop Sep 4, 2025
17 checks passed
@Dinamiko Dinamiko deleted the PCP-5192-cross-browser-appswitch-customer branch September 4, 2025 15:01
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.

4 participants