mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Do not show add PayPal payment method on subscription change payment
This commit is contained in:
parent
a979ec28ff
commit
184bfb2eee
1 changed files with 5 additions and 4 deletions
|
@ -159,10 +159,7 @@ class WcSubscriptionsModule implements ModuleInterface {
|
||||||
add_filter(
|
add_filter(
|
||||||
'woocommerce_available_payment_gateways',
|
'woocommerce_available_payment_gateways',
|
||||||
function( array $methods ) use ( $c ) : array {
|
function( array $methods ) use ( $c ) : array {
|
||||||
if (
|
if ( ! is_wc_endpoint_url( 'order-pay' ) ) {
|
||||||
! is_wc_endpoint_url( 'order-pay' )
|
|
||||||
|| $c->has( 'save-payment-methods.eligible' ) && $c->get( 'save-payment-methods.eligible' )
|
|
||||||
) {
|
|
||||||
return $methods;
|
return $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,6 +168,10 @@ class WcSubscriptionsModule implements ModuleInterface {
|
||||||
unset( $methods[ PayPalGateway::ID ] );
|
unset( $methods[ PayPalGateway::ID ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $c->has( 'save-payment-methods.eligible' ) && $c->get( 'save-payment-methods.eligible' ) ) {
|
||||||
|
return $methods;
|
||||||
|
}
|
||||||
|
|
||||||
$card_tokens = WC_Payment_Tokens::get_customer_tokens( get_current_user_id(), CreditCardGateway::ID );
|
$card_tokens = WC_Payment_Tokens::get_customer_tokens( get_current_user_id(), CreditCardGateway::ID );
|
||||||
if ( ! $card_tokens ) {
|
if ( ! $card_tokens ) {
|
||||||
unset( $methods[ CreditCardGateway::ID ] );
|
unset( $methods[ CreditCardGateway::ID ] );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue