Delete WC payment token if it does not exist for user

This commit is contained in:
Emili Castells Guasch 2024-03-18 12:18:04 +01:00
parent 2c8aecde76
commit 4f9800079f
2 changed files with 3 additions and 0 deletions

View file

@ -256,6 +256,7 @@ class RenewalHandler {
$customer_tokens = $this->payment_tokens_endpoint->payment_tokens_for_customer( $customer_id );
foreach ( $wc_tokens as $token ) {
if ( ! in_array( $token->get_token(), $customer_tokens, true ) ) {
$token->delete();
continue;
}