WooCommerce: Move Order Notes @ Checkout

We already saw how to hide Order Notes on the WooCommerce checkout page. This time around, however, our goal is to “move” them – and specifically remove them from their default position (under the shipping form) and add them back under the billing form.

As you can imagine, this is a combo snippet: (1) we remove them (and we’ll use the snippet as per the link above) and (2) we create a new billing field. Finally, (3) we also need to “save” this new field value into the original order notes custom field meta.

If this is difficult to understand don’t worry – just copy/paste the snippet into your functions.php and see magic happen. Enjoy!

Moving order notes from below shipping to the billing form @ WooCommerce Checkout

PHP Snippet: Move Order Notes @ WooCommerce Checkout

/**
 * @snippet       Move Order Notes @ WooCommerce Checkout
 * @how-to        Get CustomizeWoo.com FREE
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.9
 * @donate $9     https://businessbloomer.com/bloomer-armada/
 */

// 1. Hide default notes

add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );

// 2. Create new billing field

add_filter( 'woocommerce_checkout_fields' , 'bbloomer_custom_order_notes' );

function bbloomer_custom_order_notes( $fields ) {
	$fields['billing']['new_order_notes'] = array(
		'type' => 'textarea',
		'label' => 'New Order Notes',
		'class' => array('form-row-wide'),
		'clear' => true,
		'priority' => 999,
	);
	return $fields;
}

// 3. Save to existing order notes

add_action( 'woocommerce_checkout_update_order_meta', 'bbloomer_custom_field_value_to_order_notes', 10, 2 );

function bbloomer_custom_field_value_to_order_notes( $order_id, $data ) {
	if ( ! is_object( $order_id ) ) {
		$order = wc_get_order( $order_id );
	}
	$order->set_customer_note( isset( $data['new_order_notes'] ) ? $data['new_order_notes'] : '' );
	wc_create_order_note( $order_id, $data['new_order_notes'], true, true );
	$order->save();
}


Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (delete "?>" if you have it there). CSS, on the other hand, goes in your child theme style.css file. Make sure you know what you are doing when editing such files - if you need more guidance, please take a look at my free video tutorial "Where to Place WooCommerce Customization?"

Does this snippet (still) work?

Please let me know in the comments if everything worked as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting on PHP 7.3.

If you think this code saved you time & money, feel free to join 14,000+ WooCommerce Weekly subscribers for blog post updates or 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce?

Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.

20 thoughts on “WooCommerce: Move Order Notes @ Checkout

  1. Hello, I would like to show the comment field only when a new delivery address is selected. After ticking the box “Ship to another Address”.
    Is there a solution for this? Best regards, Fabian

    1. Hi Fabian, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  2. Thank you so much!
    It works amazingly…
    I did a small change in the last function, I share here:

    function bbloomer_custom_field_value_to_order_notes( $order_id, $data ) {
    	if ( ! is_object( $order_id ) ) {
    		$order = wc_get_order( $order_id );
    	}
    	if( $data['new_order_notes'] != '' ){
    		$order->set_customer_note( $data['new_order_notes'] );
    		wc_create_order_note( $order_id, $data['new_order_notes'], true, true );
    		$order->save();
    	}
    }
    

    Otherwise it was saving empty notes with every order!

  3. How to place the order notes field under the payment methods?

    1. Hello Joao, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  4. Hello, I would like to ask you how I can move order comment to the hook position “woocommerce_review_order_before_submit”. Thank you

    1. Hi German, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  5. Thanks for the snippet, but I think you might be conflating/combining the simple ‘Order comments’ text area on the checkout page (that has the id “order_comments”) with the ‘Order notes’ feature available in the back-end after an order is placed. Part 3 of your snippet doesn’t set the order_comments field but instead tries to create a new order note. I’ve taken a snip here if it helps explain it: https://snipboard.io/O6o5ea.jpg

    1. Thank you so much. If you just remove the “wc_create_order_note” line, does it work?

  6. Very good Rodolfo,

    I have verified that now the order notes are not saved in the customer data, they are not added to the order. They only appear in emails, but not in orders.

    Regards!

    1. Thank you Tomas! I find it weird it displays in emails and not in the orders, they come from the same data. Can you try with a different theme and no plugins but Woo?

      1. Hi Rodolfo,

        thanks for your answer. My theme is Storefront. It appears in the email but I assure you that it does not appear in the order data.

        Greetings!

        1. Thank you. I’ve revised the snippet, let me know

          1. Thanks Rodolfo for the inconvenience.
            Still not saved in the order data, however, I receive an additional email with the order notes.
            If nobody else has that problem, I suppose it will be a theme of my website.
            Anyway, thank you very much.
            Regards!!

            1. You’re welcome 🙂

  7. As always – works like a charm! But do not forget about placeholder text 🙂

    'placeholder' => 'some ultra-important description inside textarea',
    

    Greetings!

    1. Awesome!

  8. Hi Rodolfo

    It is a great idea to move the order notes, so it is much better. But it has two forgotten details:
    The first is that there is no placeholder (I have easily solved this).
    The second is that by default, in woocommerce when the customer selects the collection locally, the order notes are hidden, so it is in that location. However, with this code they are not hidden.

    A greeting!

    1. Thank you!

Questions? Feedback? Support? Leave your Comment Now!
_____

If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)

Your email address will not be published.