Allow filtering even when DB stored tokens are empty
This commit is contained in:
parent
83857de24d
commit
e6b74ad629
|
@ -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 );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue