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        Watch tutorial @ https://businessbloomer.com/?p=19055
 * @author        Rodolfo Melogli
 * @compatible    WooCommerce 3.7
 * @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_create_order', 'bbloomer_custom_field_value_to_order_notes', 10, 2 );

function bbloomer_custom_field_value_to_order_notes( $order, $data ) {
	$order->set_customer_note( isset( $data['new_order_notes'] ) ? $data['new_order_notes'] : '' );
}


Where to add this snippet?

You can place PHP snippets at the bottom of your child theme functions.php file (before "?>" if you have it). 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+.

If you think this code saved you time & money, please join other Business Bloomer supporters and avail of 365 days of WooCommerce benefits. Thank you in advance :)

Need Help with WooCommerce Customization?

Check out these free video tutorials!

  • how-to-edit-woocommerce-with-php-snippets
  • woocommerce-hooks-add_action-list-visual
  • woocommerce-customize-single-product-page-PHP

Rodolfo Melogli

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as a 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.

4 thoughts on “WooCommerce: Move Order Notes @ Checkout

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

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

    Greetings!

    1. Awesome!

  2. 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: [php]code_here[/php]. Failure to complying with this (as well as going off topic) will result in comment deletion. You should expect a reply in about a week - this is a popular blog but I need to get paid work done first. Please consider joining #BloomerArmada to ask me 1-to-1 WooCommerce questions. Thank you :)

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.