Don't force default token gateway active by default

This commit is contained in:
Mike Jolley 2018-05-18 11:30:56 +01:00
parent 92be60f3e4
commit 660649e767
1 changed files with 4 additions and 9 deletions

View File

@ -179,19 +179,14 @@ class WC_Payment_Gateways {
return; return;
} }
if ( is_user_logged_in() ) { $current_gateway = false;
$default_token = WC_Payment_Tokens::get_customer_default_token( get_current_user_id() ); $current = WC()->session->get( 'chosen_payment_method' );
if ( ! is_null( $default_token ) ) {
$default_token_gateway = $default_token->get_gateway_id();
}
}
$current = ( isset( $default_token_gateway ) ? $default_token_gateway : WC()->session->get( 'chosen_payment_method' ) );
if ( $current && isset( $gateways[ $current ] ) ) { if ( $current && isset( $gateways[ $current ] ) ) {
$current_gateway = $gateways[ $current ]; $current_gateway = $gateways[ $current ];
}
} else { if ( ! $current_gateway ) {
$current_gateway = current( $gateways ); $current_gateway = current( $gateways );
} }