Set default country code phone manually

When I access my assistant here in my office (UK) and test the Customer Contact Form Out, the telephone field defaults to US phone code. It seems that its picking up my browser > language setting which is set to US.

My customers who have not updated that setting buried inside a browser, it would still show US. Its wrong to assume that users have that setting set up correctly. Most of my customers use a work computer (we are business to business) and their devices are set up by their employer. IP detection would work better, with a setting to set a default (as a fallback).

It would be good to have a setting option for the widget to be able to select a fall back default if the IP detection failed.

1 Like

It relies on the browser device to set the default country. We are UK based, and business-to-business. The default for most PCs will be English (US), so by default, it shows US phone. Could there be a better way. IP detection? Have a setting to denote the default (in our case UK)?

Hi @user30573, thanks a lot for sharing your feedback!

You’re right, at the moment, the default country is taken from the end user’s browser settings, and I’m sorry it doesn’t seem to work well for you. We’ll try to think about alternative options to make this feature more helpful for different use cases :folded_hands:t2:

Hey everyone :waving_hand:

I am coming with the great news! Now you can set the default country code using this code in the Custom JS field on the General tab of your widget’s settings:

widget.collectContactsForm.setFieldValue('phone', '+44');

Just replace +44 with the desired country code and you’ll be fine :wink:

Note: Custom JS only works on the live site after the widget is installed —it won’t run inside the widget editor or preview.

1 Like

That’s great – many thanks!!!

2 Likes

Can the admin set the default country code of the phone number collected instead of the user has to find and select?

1 Like

Greetings and welcome to the Community, @Admin_Primus :waving_hand:

Thank you so much for the feedback!

We already have a Wishlist request for this feature and I’ve merged your comment with it. If this idea gets more traction with other users, we’ll try to think it over in the future updates.

As for now, our devs prepared a custom solution. You can find it in the message above :slightly_smiling_face: