Last active
February 14, 2023 07:33
-
-
Save raftaar1191/766518224667a17d6e47d6ff5bb5706c to your computer and use it in GitHub Desktop.
Always save the Stripe Credit card details Token into the site for later use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Always save card token for stripe: Save payment information to my account for future purchases. | |
*/ | |
add_filter( 'wc_stripe_force_save_source', '__return_true' ); | |
/** | |
* Filter the HTML of the stripe credit card details | |
*/ | |
function payment_gateway_field_html_stripe_callback( $field_html ) { | |
$field_html = str_ireplace( '<fieldset', 'style=display:none; <fieldset', $field_html ); | |
$field_html = str_ireplace( 'id="wc-stripe-new-payment-method', 'checked id="wc-stripe-new-payment-method', $field_html ); | |
return $field_html; | |
} | |
add_filter( 'cfw_payment_gateway_field_html_stripe', 'payment_gateway_field_html_stripe_callback', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://wordpress.org/support/topic/save-payment-information-to-account-by-default/