Default country code for the phone number?

How can I set a default country code for social links extension such as whatsapp, viber.
Thank you

1 Like

Hi,

Please try this PHP snippet (this snippet set the default country USA for WhatsApp):

add_filter( 'hivepress/v1/models/listing/attributes', 'custom_hp_set_countries', 1000 );
add_filter( 'hivepress/v1/models/vendor/attributes', 'custom_hp_set_countries', 1000 );

function custom_hp_set_countries($attributes){
 if(isset($attributes['whatsapp'])){
  $attributes['whatsapp']['edit_field']['country'] = 'US';
 }
 
 return $attributes;
}
1 Like

Thank you andrii
Is the same for viber? I just the change whatsapp text to viber ya?

Hi,

Yes, you can just change whatsapp to viber.