WooCommerce PHP Intermediate Requires WooCommerce

Add a Custom Order Status

Add an order status such as "Awaiting shipment" to track orders between processing and completed.

Tested on WordPress 7.1 PHP 8.3 Updated
functions.php 29 lines
add_action( 'init', function (): void {
	register_post_status( 'wc-awaiting-shipment', [
		'label'                     => 'Awaiting shipment',
		'public'                    => false,
		'exclude_from_search'       => false,
		'show_in_admin_all_list'    => true,
		'show_in_admin_status_list' => true,
		/* translators: %s: number of orders */
		'label_count'               => _n_noop( 'Awaiting shipment <span class="count">(%s)</span>', 'Awaiting shipment <span class="count">(%s)</span>' ),
	] );
} );

// Add it to WooCommerce's list, right after Processing.
add_filter( 'wc_order_statuses', function ( array $statuses ): array {
	$new = [];
	foreach ( $statuses as $key => $label ) {
		$new[ $key ] = $label;
		if ( 'wc-processing' === $key ) {
			$new['wc-awaiting-shipment'] = 'Awaiting shipment';
		}
	}
	return $new;
} );

// Count it as a paid status, so stock and reports treat it like Processing.
add_filter( 'woocommerce_order_is_paid_statuses', function ( array $statuses ): array {
	$statuses[] = 'awaiting-shipment';
	return $statuses;
} );

Where to add this

Recommended A code snippets plugin Survives theme changes and is easy to switch off.
Child theme At the end of your child theme's functions.php file.
Must-use plugin As a .php file in wp-content/mu-plugins, starting with <?php.

Always add PHP to a staging site first, or have FTP or file manager access ready, so you can undo it if something goes wrong.

WooCommerce’s statuses don’t always match how you work. If orders sit in a queue between payment and dispatch, a status like “Awaiting shipment” shows exactly where each one is.

How it works

WooCommerce order statuses start with wc-. The snippet registers the status, adds it to wc_order_statuses so it appears in the order screen’s status dropdown and bulk actions, and adds it to the paid statuses so WooCommerce treats it like Processing for stock and reports.

This works with both the classic orders table and High-Performance Order Storage.

Things to watch

  • Customers aren’t emailed when an order moves to a custom status. Add a custom email or use an automation plugin if you need one.
  • Keep the status name short: it appears as a coloured label in the orders list.

How to test it

Open an order in WooCommerce → Orders. “Awaiting shipment” should be in the status dropdown. Change an order to it and filter the list by it.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only