Skip to content

Custom order statuses

This module lets you create any WooCommerce order statuses with a configurable appearance and automatic emails.

Go to WooCommerce > Order Statuses (page polski-order-statuses, needs the manage_woocommerce capability). The service has no switch on the Modules screen: the page and the saved statuses are active while Polski PRO runs.

The page shows a table with one row per status and an empty row for a new one. Add status adds another empty row. Click Save statuses to store them; all statuses are kept in one option, polski_pro_custom_statuses.

Field Description
Slug Status identifier (max 17 characters, e.g. quality_check)
Label Displayed name (e.g. "Quality check"). Left blank, the status shows its slug with the first letter capitalised (quality_check shows as "Quality_check")
Color Background color of the status badge in the order list (color picker, default #888888)
Email Whether to send an email when an order moves to this status
Email subject Email subject, plain text (supports tokens)
Email body HTML email content (supports tokens)

The slug is cleaned with sanitize_key(): lowercase letters, digits, _ and - only. It is cut to 17 characters on save. WordPress stores the order status with the wc- prefix in a 20-character column, so 17 characters plus wc- is the maximum. A slug of quality_check becomes the status wc-quality_check.

Do not reuse the slug of a WooCommerce status (pending, processing, on-hold, completed, cancelled, refunded, failed) or of a status added by another plugin: the custom entry replaces the label of the existing status in the list.

  • The status dropdown on the order edit screen
  • The status filter links above the order list, with an order count
  • The order list badge, in the chosen color (classic shop_order list and the HPOS order list)
  • The Bulk actions menu of the order list, as "Change status to {label}"
  • Everywhere WooCommerce prints a status name through wc_get_order_statuses(), for example the order list in My Account
Token Description
{order_id} Order ID
{order_number} Order number
{first_name} Customer billing first name
{last_name} Customer billing last name
{status_from} Name of the previous status, the one the order left
{status_to} Name of the new status, the one that triggered the email
{site_title} Store name

When an order changes status (action woocommerce_order_status_changed, priority 20) and the new status is a custom status with Email on:

  1. The recipient is the order's billing email; with no billing email nothing is sent
  2. Tokens are replaced in the subject and body
  3. The body is wrapped in the WooCommerce email template (header and footer from WooCommerce > Settings > Emails) and sent as HTML with wp_mail()
  4. An order note "Custom status email sent ({label}) to {email}" is added

The email is not a separate entry in WooCommerce > Settings > Emails, so it cannot be switched off or edited there, and it goes only to the customer.

There is no delete button. Clear the Slug field of the row and save: rows without a slug are dropped.

A status that orders still use is not deleted. The save keeps it and shows the notice "Not deleted, orders still use these statuses: {slugs}. Move those orders to another status first." Move those orders first (filter the list by the status and use a bulk action), then remove the status again. Changing the slug of a status in use works the same way: the new status is added and the old one stays.

The module adds no filters or actions of its own. It hooks into these WooCommerce and WordPress hooks:

Hook Purpose
init Registers each status with register_post_status()
wc_order_statuses Adds the statuses to the WooCommerce status list
bulk_actions-edit-shop_order, bulk_actions-woocommerce_page_wc-orders Adds the mark_{slug} bulk actions
woocommerce_order_status_changed Sends the status email

Code that reacts to a custom status can use the standard WooCommerce action woocommerce_order_status_{slug}, for example woocommerce_order_status_quality_check.

  • Statuses visible in the order status change dropdown
  • Colored badges in the order list
  • Bulk actions for each status
  • Email to the customer, wrapped in the WooCommerce template
  • Unlimited number of statuses