Ready-Made Order Note Templates
Adds a dropdown of saved phrases above the order notes box, such as "Dispatched with Royal Mail" or "Waiting for stock", so staff can add common notes in one click.
Opens WPIDE on
Code
$wpide_note_templates = array(
'Dispatched today. Tracking details will follow by email.',
'Waiting for stock from our supplier; expected within 5 working days.',
'Customer contacted by phone about delivery.',
'Address checked and confirmed with the customer.',
);
add_action( 'admin_footer', function () use ( $wpide_note_templates ) {
$screen = get_current_screen();
if ( ! $screen || ! function_exists( 'wc_get_page_screen_id' ) || wc_get_page_screen_id( 'shop-order' ) !== $screen->id ) {
return;
}
?>
<script>
( function () {
var box = document.getElementById( 'add_order_note' );
if ( ! box ) { return; }
var templates = <?php echo wp_json_encode( array_values( $wpide_note_templates ) ); ?>;
var select = document.createElement( 'select' );
select.setAttribute( 'aria-label', 'Insert a note template' );
select.style.width = '100%';
select.style.marginBottom = '6px';
select.add( new Option( 'Insert a note template…', '' ) );
templates.forEach( function ( text ) { select.add( new Option( text, text ) ); } );
select.addEventListener( 'change', function () {
if ( select.value ) { box.value = select.value; box.focus(); select.selectedIndex = 0; }
} );
box.parentNode.insertBefore( select, box );
} )();
</script>
<?php
} );
Notes
Edit the phrases in $wpide_note_templates; picking one fills the note box and you still choose private or customer note.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.