diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-method-link.php b/includes/payment-methods/class-wc-stripe-upe-payment-method-link.php index c34a52ba5..b1d6721e4 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-method-link.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-method-link.php @@ -32,7 +32,6 @@ public function __construct() { * @return bool */ public static function is_link_enabled() { - // Assume Link is disabled if UPE is disabled. if ( ! WC_Stripe_Feature_Flags::is_upe_checkout_enabled() ) { return false; diff --git a/woocommerce-gateway-stripe.php b/woocommerce-gateway-stripe.php index b13832117..0a4185902 100644 --- a/woocommerce-gateway-stripe.php +++ b/woocommerce-gateway-stripe.php @@ -379,8 +379,8 @@ public function install() { public function update_prb_location_settings() { $stripe_settings = WC_Stripe_Helper::get_stripe_settings(); $prb_locations = isset( $stripe_settings['payment_request_button_locations'] ) - ? $stripe_settings['payment_request_button_locations'] - : []; + ? $stripe_settings['payment_request_button_locations'] + : []; if ( ! empty( $stripe_settings ) && empty( $prb_locations ) ) { global $post; @@ -483,6 +483,16 @@ public function add_gateways( $methods ) { } } + // Don't mark Link as enabled if we're in the admin so it doesn't show up in the checkout editor page. + if ( is_admin() ) { + $methods = array_filter( + $methods, + function( $method ) { + return WC_Stripe_UPE_Payment_Method_Link::class !== $method; + } + ); + } + return $methods; }