Save funding source for block orders

This commit is contained in:
Alex P 2023-04-21 11:12:32 +03:00
parent 8f3e9c4554
commit 98f6d0de45
No known key found for this signature in database
GPG key ID: 54487A734A204D71
3 changed files with 20 additions and 9 deletions

View file

@ -424,7 +424,13 @@ class PayPalGateway extends \WC_Payment_Gateway {
}
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$funding_source = wc_clean( wp_unslash( $_POST['ppcp-funding-source'] ?? '' ) );
$funding_source = wc_clean( wp_unslash( $_POST['ppcp-funding-source'] ?? ( $_POST['funding_source'] ?? '' ) ) );
if ( $funding_source ) {
$wc_order->set_payment_method_title( $this->funding_source_renderer->render_name( $funding_source ) );
$wc_order->save();
}
if ( 'card' !== $funding_source && $this->is_free_trial_order( $wc_order ) ) {
$user_id = (int) $wc_order->get_customer_id();
$tokens = $this->payment_token_repository->all_for_user_id( $user_id );