Looking for help?
How to set a default customer on OpenPOS
#1. Choose customer you want in admin/user and take note this user email
#2. open your_active_theme/functions.php , add this code to your end of this file;
function custom_default_order_customer($order_data){
$customer = isset($order_data['customer']) ? $order_data['customer'] : array();
$customer_id = isset($customer['id']) ? $customer['id'] : 0;
$customer_email = isset($customer['email']) ? $customer['email'] : '';
$customer_phone = isset($customer['phone']) ? $customer['phone'] : '';
$customer_name = isset($customer['name']) ? $customer['name'] : '';
if(!$customer_id && !$customer_name && !$customer_phone)
{
if(class_exists('Openpos_Front'))
{
global $op_woo;
$default_customer_email = '1555780170@mail.com'; // set your default customer email
$customer_user = get_user_by('email',$default_customer_email);
if($customer_user)
{
$customer_id = $customer_user->get('ID');
$customer_data = $op_woo->formatCustomer($customer_id);
$order_data['customer'] = $customer_data;
}
}
}
return $order_data;
}
add_filter('op_new_order_data','custom_default_order_customer',30,1);
#3. Change “1555780170@mail.com” to your email you note on step 1.
#4. Done