-
Notifications
You must be signed in to change notification settings - Fork 206
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
Don't mark Stripe Link as enabled in the admin #3516
Conversation
f8f0aef
to
b06e32c
Compare
Updated logic so it removes Link from the main gateway filter instead of adding logic in the gateway class The check here still only does |
woocommerce-gateway-stripe.php
Outdated
$methods = array_filter( | ||
$methods, | ||
function( $method ) { | ||
return ! is_a( $method, 'WC_Stripe_UPE_Payment_Method_Link' ); |
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.
Nit-pick: I would use WC_Stripe_UPE_Payment_Method_Link::class
instead, just for a more straightforward lookup and to avoid issues with class renaming.
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.
Good catch!
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 fixing this @senadir!
I could not find any side effects, all critical flows test well... (the legacy checkout E2E test is failing in guthub because of a timeout, it works fine locally.. and I also tested it manually)
48c7630
to
2606489
Compare
I prematurely merged this before testing the refactor 😞 Pushing another PR to fix it. #3547 |
Fixes #3356
Changes proposed in this Pull Request:
This PR resolves an issue in which Stripe Link would be marked as incompatible with Checkout block. To decide if a payment method is compatible or not, Checkout block would compare all registered gateways in
woocommerce_payment_gateways
and make sure they have a corresponding JS paymentGateway or expressPaymentGateway. Stripe Link alongside Google Pay and Apple Pay all use the samestripe
express payment registry, however, in PHP, Stripe Link register its own gateway classWC_Stripe_UPE_Payment_Method_Link
. This ends up marking it as incompatible.There are several possible solutions to this, the least intrusive so far,
is to markWC_Stripe_UPE_Payment_Method_Link
as disabled on all admin requests. This seems to work fine in admin and frontend, and doesn't break anything from what I saw.Sadly changing
$this->enabled
broke certain unit tests that I couldn't figure out how to fix. I moved the logic to the mainwoocommerce_payment_gateways
filter call.This code might break any admin logic that depends on Stripe Link being marked enabled. I checked and couldn't find anything.
Another option was to limit disable to only Gutenberg pages, but it was too early to reach for
get_current_screen
.Before: (those are before and after from a PR woocommerce/woocommerce#52070 but for this PR, both are considred before).
After:
Testing instructions
changelog.txt
andreadme.txt
(or does not apply)Post merge