Change wording, "Save to account" at WooCommerce checkout

There is a public function called “save_payment_method_checkbox()” in WooCommerce that prints “Save to account” at WooCommerce checkout. Here is the function:

 * Outputs a checkbox for saving a new payment method to the database.
 * @since 2.6.0
public function save_payment_method_checkbox() {
        '<p class="form-row woocommerce-SavedPaymentMethods-saveNew">
            <input id="wc-%1$s-new-payment-method" name="wc-%1$s-new-payment-method" type="checkbox" value="true" style="width:auto;" />
            <label for="wc-%1$s-new-payment-method" style="display:inline;">%2$s</label>
            esc_attr( $this->id ),
            esc_html__( 'Save to account', 'woocommerce' )

I have edited the code (not ideal as it is core) so it displays “Save to my xxx account”. Does anybody know if there is a filter or hook available to change this text instead of changing core? I have tried using jQuery to rename the string that does show for a brief 2 seconds but when the page has fully loaded it is overwritten:

jQuery("label[for='wc-gocardless-new-payment-method']").each(function() {
var text = jQuery(this).text();
text = text.replace("Save to Account", "Save to my xxx Account");


Read more here: Change wording, "Save to account" at WooCommerce checkout

Leave a Reply

Your email address will not be published. Required fields are marked *