@jeriss
Unfortunately, the YITH Point of Sale is available only in the premium version, and I cannot access the source code to assist you precisely with this issue. However, it is doable if you follow these steps:
Add the custom field using the intl_phone_number_format_fields
filter. Here’s an example code snippet:
<?php
add_filter('intl_phone_number_format_fields', function ($fields){
$fields[] = array(
'id' => 'mobile',
'enable' => true,
'desc' => 'Mobile phone number on the customer page',
'label' => 'Mobile',
'frontend_validation' => true, // JS frontend validation
'backend_validation' => true, // Backend validation
'countries' => 'all', // Countries related to fields (all, billing, or shipping)
'type' => 'custom', // Field type (custom, billing, or shipping)
);
return $fields;
});
The id should be similar to the phone number field in the “Create Customer” page. You can inspect the input element to get the input ID.
To include the International Phone Number Format JS files on that page, you need to know the exact page and apply this hook., you can include it using the following method:
<?php
add_filter('intl_phone_number_format_validate_enqueue_js', function ($valid){
// Your condition here, check page URL to detect the "create customer" page.
// if (create customer page)
// $valid = true;
return $valid;
});