I'm using the International Phone Number Format plugin on my WooCommerce and it's working fine on all default WooCommerce pages to format the phone numbers with their country code.
Now I need to integrate this plugin with YITH Point of Sale where I manage my client accounts. I've contacted the support of the phone plugin and in this ticket, they've provided me the basics but I'm getting a bit lost.
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;
});
In this link, you can see a screenshot of the phone number field in the Point of Sale where we can normally see the ID of the phone number field. But I'm not sure what it should be.
Then to include the JS files on the Point of Sale. The URL should be 'https://www.autoparts.com/pos/' but I don't know how to add it.
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;
});
Can someone help me please?
Thanks