diff --git a/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php b/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php index 52c3366d0..172837633 100644 --- a/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php +++ b/modules/ppcp-vaulting/src/VaultedCreditCardHandler.php @@ -145,14 +145,14 @@ class VaultedCreditCardHandler { ): WC_Order { $change_payment = filter_input( INPUT_POST, 'woocommerce_change_payment', FILTER_SANITIZE_STRING ); - if ( $change_payment ) { - if ( $this->subscription_helper->has_subscription( $wc_order->get_id() ) && $this->subscription_helper->is_subscription_change_payment() ) { - if ( $saved_credit_card ) { - update_post_meta( $wc_order->get_id(), 'payment_token_id', $saved_credit_card ); - - return $wc_order; - } - } + if ( + $change_payment + && $this->subscription_helper->has_subscription( $wc_order->get_id() ) + && $this->subscription_helper->is_subscription_change_payment() + && $saved_credit_card + ) { + update_post_meta( $wc_order->get_id(), 'payment_token_id', $saved_credit_card ); + return $wc_order; } $tokens = $this->payment_token_repository->all_for_user_id( $wc_order->get_customer_id() );