WooCommerce - add prefix to order number for specific users
<?php
add_filter( 'woocommerce_order_number', 'arglebargle_order_number' );
function arglebargle_order_number( $order_id ) {
$o = new WC_Order( $order_id );
$usr = new WP_User( $o->get_customer_id() );
if( in_array( 'administrator', $usr->roles ) ) {
return ( 'ARGLE-' . $order_id ) ;
} else {
return ( $order_id );
}
}