Sculpt-it
Sculpt-it

Reputation: 41

Change order notes checkout field placeholder in Woocommerce

In woocommerce, I am wondering how to remove from the "Order notes" checkout field placeholder this text "e.g. special notes for delivery", as my store does not ship products and it just sounds out of context.

So I am trying to edit the template checkout/form-shipping.php without success.

How to change order notes checkout field placeholder?

Any help is appreciated.

Upvotes: 4

Views: 8541

Answers (3)

Rainer Lanemann
Rainer Lanemann

Reputation: 123

There's also translation possibility. Goes inside functions.php of your child or main theme or any code snippet plugin. Tested and works.

Will do the trick if earlier solutions won't work.

add_filter('gettext', 'translate_text',999);

function translate_text($translated) {
    $translated = str_ireplace('Your old placeholder text', 'New placeholder text', $translated);
    return $translated;
}

Upvotes: 0

paul
paul

Reputation: 93

Add the below coding inside function.php file in your child theme.

function md_custom_woocommerce_checkout_fields( $fields ) 
    {
        $fields['order']['order_comments']['placeholder'] = 'Special notes';
        $fields['order']['order_comments']['label'] = 'Add your special note';
    
        return $fields;
    }
    add_filter( 'woocommerce_checkout_fields', 'md_custom_woocommerce_checkout_fields' );

Upvotes: 6

LoicTheAztec
LoicTheAztec

Reputation: 253968

You don't need to edit any template file, jsut use the following code snippet:

add_filter( 'woocommerce_checkout_fields' , 'change_order_notes_placeholder' );
function change_order_notes_placeholder( $fields ) {
     $fields['order']['order_comments']['placeholder'] = _x('Notes about your order...', 'placeholder', 'woocommerce');

     return $fields;
}

Code goes in function.php file of your active child theme (or active theme). Tested and work.

enter image description here

Upvotes: 9

Related Questions