3
votes

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.

3

3 Answers

5
votes

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

2
votes

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' );
0
votes

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;
}