Skip to content

Instantly share code, notes, and snippets.

Avatar

Tin Ho Chu tinhochu

View GitHub Profile
@tinhochu
tinhochu / kia_convert_country_code.php
Created Dec 12, 2016 — forked from helgatheviking/kia_convert_country_code.php
Converts the WooCommerce country codes to 3-letter ISO codes
View kia_convert_country_code.php
<?php
/**
* Converts the WooCommerce country codes to 3-letter ISO codes
* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
* @param string WooCommerce's 2 letter country code
* @return string ISO 3-letter country code
*/
function kia_convert_country_code( $country ) {
$countries = array(
'AF' => 'AFG', //Afghanistan