Allow filtering even when DB stored tokens are empty

This commit is contained in:
Mike Jolley 2016-05-16 15:32:54 +01:00
parent 83857de24d
commit e6b74ad629
1 changed files with 8 additions and 9 deletions

View File

@ -35,11 +35,9 @@ class WC_Payment_Tokens {
$customer_id
) );
if ( empty( $token_results ) ) {
return array();
}
$tokens = array();
if ( ! empty( $token_results ) ) {
foreach ( $token_results as $token_result ) {
if ( empty( $gateway_id ) || $gateway_id === $token_result->gateway_id ) {
$_token = self::get( $token_result->token_id, $token_result );
@ -48,6 +46,7 @@ class WC_Payment_Tokens {
}
}
}
}
return apply_filters( 'woocommerce_get_customer_payment_tokens', $tokens, $customer_id );
}