Looking for help?
< All Topics
Print

How to separate customer name to First name and Last name ?

add this code to yourtheme/functions.php or use any snippets code plugin like as https://wpos.app/knowledge-base/category/code-snippets/


function custom_op_basic_customer_field($session_response_data){
  
    $firstname = array(
        'code' => 'firstname',
        'type' => 'text',
        'label' => "First name",
        'options'=> [],
        'placeholder' => "First name",
        'description' => '',
        'default' => '',
        'allow_shipping' => 'yes',
        'required' => 'no',
        'searchable' => 'no'
    );
    $lastname = array(
        'code' => 'lastname',
        'type' => 'text',
        'label' => "Last name",
        'options'=> [],
        'placeholder' => "Last name",
        'description' => '',
        'default' => '',
        'allow_shipping' => 'yes',
        'required' => 'no',
        'searchable' => 'no'
    );
    
    
    $email_field = array(
        'code' => 'email',
        'type' => 'email',
        'label' => 'Email',
        'placeholder' => 'Email',
        'description' => '',
        'default' => '',
        'allow_shipping' => 'no',
        'required' => 'yes',
        'searchable' => 'yes',
        'editable' => 'no'
    );
    $phone_field = array(
        'code' => 'phone',
        'type' => 'text',
        'label' => 'Phone',
        'placeholder' => 'Phone',
        'description' => '',
        'default' => '',
        'allow_shipping' => 'yes',
        'required' => 'no',
        'searchable' => 'yes'
    );
   
    $session_response_data['setting']['openpos_customer_fields'] = array($firstname,$lastname,$email_field,$phone_field);
    return $session_response_data;
}
add_filter('op_get_login_cashdrawer_data','custom_op_basic_customer_field',20,1);
Table of Contents