-
Notifications
You must be signed in to change notification settings - Fork 57
Migrate AppSwitch cross-browser handling logic to frontend (5428) #3755
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
base: develop
Are you sure you want to change the base?
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 1418c57 • Last updated: 2025-10-08T22:33:27.584Z |
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 Himad. Left a couple of minor suggestions. Also please check the Unit tests
/** | ||
* Register filters that handle cross-browser AppSwitch orders. | ||
* These filters allow guests to access pay-for-order and order-received pages | ||
* for orders created via cross-browser AppSwitch flows. | ||
*/ |
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.
/** | |
* Register filters that handle cross-browser AppSwitch orders. | |
* These filters allow guests to access pay-for-order and order-received pages | |
* for orders created via cross-browser AppSwitch flows. | |
*/ | |
/** | |
* Registers filters that handle cross-browser AppSwitch orders. | |
* | |
* These filters allow guests to access pay-for-order and order-received pages | |
* for orders created via cross-browser AppSwitch flows. | |
*/ |
|
||
class CreateCrossBrowserOrderEndpoint implements EndpointInterface { | ||
|
||
const ENDPOINT = 'ppc-create-cross-browser-order'; |
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.
Please add visibility.
const ENDPOINT = 'ppc-create-cross-browser-order'; | |
public const ENDPOINT = 'ppc-create-cross-browser-order'; |
assert( ! empty( $key ) ); | ||
|
||
$custom_args[ self::RETURN_URL_CART_QUERY_ARG ] = $key; | ||
$custom_args['pcp-cart-hash'] = $cart_data->cart_hash(); |
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 think the indent is not correctly aligned here
The previous approach for handling cross-browser AppSwitch flows relied on adding query parameters to the return URL. This approach broke the same-tab AppSwitch flow because with the addition of the query parameters, the browser detected the return URL as a different URL and opened a new tab, causing all orders to go through the resume flow.
To solve this, this PR migrates the cross-browser detection and handling logic to the frontend.