Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. maxrice created this gist Aug 3, 2015.
    11 changes: 11 additions & 0 deletions wc-auth-net-cim-save-payment-method-default-checked.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <?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 );