You may want to add a prefix to your WooCommerce order numbers to make them easier to identify or match your internal processes. This simple code snippet lets you do that safely, without affecting your existing orders or subscriptions.
add_filter( 'woocommerce_order_number', 'ag_add_prefix_to_order_number', 10, 2 );
function ag_add_prefix_to_order_number( $order_number, $order ) {
$prefix = 'AG-'; // Change this to whatever prefix you want
return $prefix . $order_number;
}Copy the code snippet provided above.
Add it to your site safely, either in a child theme’s functions.php file or using a code snippet plugin.
Save and check your orders, the prefix should now appear in your order numbers.
Was this helpful?
Our team are on hand to provide fast, helpful and professional support.