mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-04 08:47:23 +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(
|
||||
'woocommerce_available_payment_gateways',
|
||||
function( array $methods ) use ( $c ) : array {
|
||||
if (
|
||||
! is_wc_endpoint_url( 'order-pay' )
|
||||
|| $c->has( 'save-payment-methods.eligible' ) && $c->get( 'save-payment-methods.eligible' )
|
||||
) {
|
||||
if ( ! is_wc_endpoint_url( 'order-pay' ) ) {
|
||||
return $methods;
|
||||
}
|
||||
|
||||
|
@ -171,6 +168,10 @@ class WcSubscriptionsModule implements ModuleInterface {
|
|||
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 );
|
||||
if ( ! $card_tokens ) {
|
||||
unset( $methods[ CreditCardGateway::ID ] );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue