Frequently Asked Questions
How to add more field in add new customer / edit customer on POS
I got many my customer request about add more field to add / edit customer form in POS . And since version 2.3.6 , you can add more field to pos customer form by this way.
Add those code to end of file : your_theme/function.php
and in this sample, i will add company field to add/edit customer form in POS
#1 : Add customer custom field (company) to POS
#4: Update customer custom field (company)

#5. Display custom field on receipt composer
Add those code to end of file : your_theme/function.php
and in this sample, i will add company field to add/edit customer form in POS
#1 : Add customer custom field (company) to POS
if(!function_exists('pricechangeable_op_get_login_cashdrawer_data'))
{
function pricechangeable_op_get_login_cashdrawer_data($session_response_data){
$text_field = array(
'code' => 'test_new_field',
'type' => 'text',
'label' => 'Company',
'placeholder' => 'Enter New Field',
'description' => '',
'required' => 'no',
'allow_customer' => 'yes', // no if not hide on billing
'allow_shipping' => 'no' // value yes / no to allow display on shipping field
);
/*
$date_field = array(
'code' => 'dob',
'type' => 'date',
'label' => 'DOB',
'placeholder' => 'Enter birthday',
'description' => '',
'allow_shipping' => 'no' // value yes / no to allow display on shipping field
);
$select_field = array(
'code' => 'gender',
'type' => 'select',
'label' => 'Gender',
'options' => array(
['value' => 'male','label' => 'Male'],
['value' => 'female','label' => 'Female'],
),
'placeholder' => 'Gender',
'description' => ''
);
$multiselect_field = array(
'code' => 'multiselect',
'type' => 'multi_select',
'label' => 'Multi Select',
'options' => array(
['value' => 'male','label' => 'Male'],
['value' => 'female','label' => 'Female'],
),
'placeholder' => 'Multi Select',
'description' => ''
);
$radio_field = array(
'code' => 'radio',
'type' => 'radio',
'label' => 'Radio',
'options' => array(
['value' => 'male','label' => 'Male'],
['value' => 'female','label' => 'Female'],
),
'placeholder' => 'Radio Sample',
'description' => ''
);
$checkbox_field = array(
'code' => 'checkbox',
'type' => 'checkbox',
'label' => 'Checkbox',
'options' => array(
['value' => 'male','label' => 'Male'],
['value' => 'female','label' => 'Female'],
),
'placeholder' => 'Checkbox Sample',
'description' => ''
);
*/
$session_response_data['setting']['openpos_customer_addition_fields'][] = $text_field;
//$session_response_data['setting']['openpos_customer_addition_fields'][] = $date_field;
//$session_response_data['setting']['openpos_customer_addition_fields'][] = $select_field;
//$session_response_data['setting']['openpos_customer_addition_fields'][] = $multiselect_field;
//$session_response_data['setting']['openpos_customer_addition_fields'][] = $radio_field;
//$session_response_data['setting']['openpos_customer_addition_fields'][] = $checkbox_field;
return $session_response_data;
}
}
add_filter('op_get_login_cashdrawer_data','pricechangeable_op_get_login_cashdrawer_data',10,1);
#2: get customer custom field (company) when get customer datafunction pricechangeable_op_customer_data($data){
$customer_id = isset($data['id']) ? $data['id'] : 0;
if($customer_id)
{
$customer = new WC_Customer($customer_id);
$data['test_new_field'] = get_user_meta( $customer_id, 'test_new_field', true );
}
return $data;
}
add_filter('op_customer_data','pricechangeable_op_customer_data',10,1);
#3: Save new customer custom field (company)add_action('op_add_customer_after',function($customer_id,$session_data,$customer_request_data){
if(isset($customer_request_data['test_new_field']) && $customer_request_data['test_new_field'])
{
$test_new_field = isset( $customer_request_data['test_new_field'] ) ? $customer_request_data['test_new_field'] : '';
update_user_meta( $customer_id, 'test_new_field', $test_new_field );
}
},100,3);
#4: Update customer custom field (company)
add_action('op_update_customer_after',function($customer_id,$session_data,$customer_request_data){
if(isset($customer_request_data['test_new_field']) && $customer_request_data['test_new_field'])
{
$test_new_field = isset($customer_request_data['test_new_field']) ? $customer_request_data['test_new_field'] : '';
update_user_meta( $customer_id, 'test_new_field', $test_new_field );
}
},100,3);
And this is the result . Please take note logout and login POS again to get effect.#5. Display custom field on receipt composer
<%= customer.test_new_field %>
Last updated Wed, Sep 19 2018 6:50pm