-
Notifications
You must be signed in to change notification settings - Fork 55
Keep order customer association after cross-browser AppSwitch for logged in users #3613
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
Conversation
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. 🔗 Test this pull request with WordPress Playground What's included:
Login credentials:
Plugin Details:
🤖 Auto-generated for commit 3e6c4bf • Last updated: 2025-09-04T15:00:52.391Z |
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.
Thanks for working on this. Left a small suggestion which doesn't prevent me from approving.
* | ||
* @psalm-suppress MissingClosureParamType | ||
*/ | ||
add_filter( |
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.
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
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.
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.
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 touser1
.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.