Buy B2BKing
$299 $199
By default, B2BKing adds a B2B column to the Orders page, making it easy to identify which orders are B2B:
Note: For this to work, the plugin must be set to "B2B & B2C Hybrid Shop" in B2BKing -> Settings -> Main Settings.
However, you may also want to change the order numbers. Here's what you need to know.
You may want to differentiate between B2B and B2C orders via the order number if you are running a hybrid site. Here is a simple code snippet that can do it.
// Add Prefix to Orders by B2B add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' ); function change_woocommerce_order_number( $order_id ) { // get if customer is B2B $order = wc_get_order($order_id); if ($order){ // Check if the order is a refund object if (is_a($order, 'WC_Order_Refund')) { return $order_id; } $customer_id = $order->get_customer_id(); $customer_b2b = get_user_meta($customer_id,'b2bking_b2buser', true); if ($customer_b2b === 'yes'){ $prefix = 'PRO-'; $suffix = ''; $order_id = $prefix . $order_id . $suffix; } } return $order_id; }
This code adds "PRO-" to all orders placed by B2B customers.
Here's what that looks like in practice in the backend:
This is a simple way to differentiate between orders, and it can be useful in many scenarios, especially for delivery and order fulfillment.
Powered by BetterDocs