I want to add shop name in order number.
For example, there are two vendors on my marketplace:
- Sepatu Shop
- Baju Shop
If the customer orders products from both the Sepatu Shop and Baju Shop vendors, the respective order numbers must be like this:
- VK/4571-Sepatu Shop
- VK/4572-Baju Shop
The structure must be: {prefix}/{order_id}-{vendor_name}
The code I've tried so far is this but it doesn't work:
add_filter( 'woocommerce_order_number', 'change_woocommerce_order_number' );
function change_woocommerce_order_number( $order_id ) {
$shop_name = dokan()->vendor->get( $author_id )->get_shop_name();
$prefix = 'VK/';
$suffix = $shop_name;
$new_order_id = $prefix . $order_id . $suffix;
return $new_order_id;
}