WC_Countries::get_country_calling_code( string $cc )
Get calling code for a country code.
Description Description
Parameters Parameters
- $cc
-
(Required) Country code.
Return Return
(string|array) Some countries have multiple. The code will be stripped of - and spaces and always be prefixed with +.
Source Source
File: includes/class-wc-countries.php
public function get_country_calling_code( $cc ) { $codes = wp_cache_get( 'calling-codes', 'countries' ); if ( ! $codes ) { $codes = include WC()->plugin_path() . '/i18n/phone.php'; wp_cache_set( 'calling-codes', $codes, 'countries' ); } $calling_code = isset( $codes[ $cc ] ) ? $codes[ $cc ] : ''; if ( is_array( $calling_code ) ) { $calling_code = $calling_code[0]; } return $calling_code; }
Changelog Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |