We currently run a shop with 2 shop managers, and based on fairness, I want them to be able to basically receive the same number of customers and process orders.
My current idea is to check the last digit of the billing phone number of the order and if it is the base number (1,3,5,7,9) then assign it to the first shop manager.
or of it is an even number (2,4,6,8,0) it will be assigned to the second shop manager.
If this is difficult to achieve then is it possible to do that by the last digit of the order number?
Any suggestions?
Thanks!
from this link How can I assign an order to a certain shop manager in Woocommerce
i found this code is similar one, but assign by countries doesn’t suit my store
function before_checkout_create_order($order, $data) {
$country = $order->billing_country;
$store_manager_id = '';
$belgium_region = ['BE', 'NL', 'DE'];
$czech_region = ['CZ', 'AT', 'SI', 'HU'];
$uk_region = ['GB'];
if (in_array($country, $belgium_region)) {
// Manually assigning the _store_manager_id using the user id, yours will differ
$store_manager_id = 7;
} else if (in_array($country, $czech_region)) {
$store_manager_id = 3;
} else if (in_array($country, $uk_region)) {
$store_manager_id = 2;
} else {
$store_manager_id = 1;
}
$order->update_meta_data('_store_manager_id', $store_manager_id);
}
add_action('woocommerce_checkout_create_order', 'before_checkout_create_order', 20, 2);