Add a Prefix to Order Numbers
Shows order numbers with a prefix such as "WEB-1045" in emails, My Account and the admin, without changing the real order IDs.
Opens WPIDE on
Code
add_filter( 'woocommerce_order_number', function ( $number ) {
$prefix = 'WEB-'; // Text before every order number.
return $prefix . $number;
}, 20 );
Notes
Searching the orders screen still uses the plain number. Payment gateways may display the prefixed number in their dashboards.
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.