How to Add a Custom Prefix Order Number for Wholesale Orders

How to Add a Custom Prefix Order Number for Wholesale Orders

When you received a wholesale order, you』ll notice that we have added a new column in the WooCommerce Order page. This will help you differentiate which order is from a wholesale customer.

Order Type Column

You may want to take this further by differentiating the Order Number for the Wholesale Orders as well. You can add the following snippet to your child theme』s function.php:

add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' );
function change_woocommerce_order_number( $order_id ) {

$prefix = 'WH-'; //The Prefix
$order_type = get_post_meta( $order_id, '_wwpp_order_type',true); //get Wholesale Order Type

if ($order_type == 'wholesale') {
$new_order_id = $prefix . $order_id;
return $new_order_id;
}

return $order_id;
}

Here』s how it will looks like:
Custom Prefix on Order Number of a Wholesale Order

發表回覆

您的郵箱地址不會被公開。 必填項已用 * 標註