Forked from maxrice/wc-auth-net-cim-save-payment-method-default-checked.php
Created
March 15, 2022 22:00
-
-
Save sumonst21/f307956726cea4e9768d92bd435acecb to your computer and use it in GitHub Desktop.
WC Authorize.net CIM: On the payment form, default "securely save to account" checkbox to checked
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
<?php | |
// force the "securely save to account" checkbox to default to checked | |
function wc_auth_net_cim_save_payment_method_default_checked( $html, $form ) { | |
if ( empty( $html ) || $form->tokenization_forced() ) { | |
return $html; | |
} | |
return str_replace( 'type="checkbox"', 'type="checkbox" checked="checked"', $html ); | |
} | |
add_filter( 'wc_authorize_net_cim_credit_card_payment_form_save_payment_method_checkbox_html', 'wc_auth_net_cim_save_payment_method_default_checked', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment