• Hey,
    I tried searching on google, woocommerce support forums, stackoverflow but could not get my answer. I need to change the text “Account username” and “Account password” from the checkout page. Can anyone please help me regarding this? Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Here is the way you can change the label of checkout fields as well as the placeholder of those fields.

    Simplay copy and past below code in your function.php save and refresh the checkout page label of first name was changed to (“select a state”),

    and if you want to change the place holder of those fields you simply replace the [‘label’] to [‘Placeholder’].

    add_filter( ‘woocommerce_checkout_fields’ , ‘hjs_wc_checkout_fields’ );

    function hjs_wc_checkout_fields( $fields ) {

    $fields[‘billing’][‘billing_first_name’][‘label’] = ‘Select A State’;

    return $fields;
    }

    Thread Starter Fzn.shaikh

    (@fznshaikh)

    Hey,
    jazakallah for your reply.
    I added
    add_filter( ‘woocommerce_checkout_fields’ , ‘hjs_wc_checkout_fields’ );
    function hjs_wc_checkout_fields( $fields ) {

    $fields[‘account_username’]= ‘Select A State’;

    return $fields;
    }
    to see if anything happens. But no changes.
    I saw the page https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ But I could not understand how to use it.

    Thread Starter Fzn.shaikh

    (@fznshaikh)

    Also, I want to modify the text in the fields when a user is asked to create an account while checking out. Thanks
    Account username
    Username
    Account password
    Password

    Faizan bro you simply add this code in you function.php this will change the things for you. You dont modify the below code simply copy an past.

    for account user name:

    add_filter( 'woocommerce_checkout_fields' , 'hjs_wc_checkout_fields' );
    function hjs_wc_checkout_fields( $fields ) {
     $fields['account']['account_username']['label'] = 'Select A State';
     return $fields;
    }

    for account user password:

    add_filter( 'woocommerce_checkout_fields' , 'hjs_wc_checkout_fields' );
    
    function hjs_wc_checkout_fields( $fields ) {
     $fields['account']['account_password']['label'] = 'Select A State';
     return $fields;
    }

    you just change the [‘label’] to [‘placeholder’] if and only if you change the placeholder of text and if you change label use same code as above.

    Thread Starter Fzn.shaikh

    (@fznshaikh)

    Jazakallah. Worked perfectly bro. Here’s how I added.

    add_filter( 'woocommerce_checkout_fields' , 'hjs_wc_checkout_fields' );
    function hjs_wc_checkout_fields( $fields ) {
     $fields['account']['account_username']['label'] = 'Custom Text';
     $fields['account']['account_password']['label'] = 'Custom Text';
     $fields['account']['account_username']['placeholder'] = 'Custom Text';
     $fields['account']['account_password']['placeholder'] = 'Custom Text';
     return $fields;
    }

    your welcome thankyou

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to change the “Account Username” & “Account Password” text from WooCommerce?’ is closed to new replies.