Skip to content

Commit

Permalink
Don't mark Stripe Link as enabled in the admin (#3516)
Browse files Browse the repository at this point in the history
* Don't mark Stripe Link as enabled in the admin

* move logic to main stripe file instead

* use full class name
  • Loading branch information
senadir authored Oct 24, 2024
1 parent 4bb5743 commit 8e8c559
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 12 additions & 2 deletions woocommerce-gateway-stripe.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 8e8c559

Please sign in to comment.