4

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.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
Sculpt-it
  • 41
  • 1
  • 3

3 Answers3

8

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

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • Hi there, thank you for your speedy response. I placed the code in the functions.php within the child theme but I am afraid it did not change anything... – Sculpt-it Jul 21 '18 at 11:29
  • @Sculpt-it It does work and it's the only way as there is nothing in the templates, but your theme or a plugin is certainly doing some customizations already and that's why it doesn't work for you. Try to contact me on Google Hangouts or in skype chat searching for Loïc de Marcé … – LoicTheAztec Jul 21 '18 at 12:14
5

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' );
paul
  • 83
  • 1
  • 10
0

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;
}
Rainer Lanemann
  • 123
  • 2
  • 12