Skip to main content
Fixes

How to add Canary Islands shipping to Woocommerce

By 09/05/2023May 23rd, 2023One Comment

The Canary Islands are an autonomous community of Spain (they make their own laws), but they belong to Spain and do speak Spanish. Getting websites to configure postage/shipping to these islands is tough as they are not included in Woocommerce out of the box.

We found a few solutions that would add the Canary Islands to Woocommerce as a country, which incidentally did not work as we think because the posts are old and WordPress and Woocommerce have updated since then.

The best way we found is to add the regions to your WordPress theme’s functions.php file. Please don’t add this code to your parent theme’s functions.php file as this will be deleted if you update it.

This can be copied to use for the Canary Islands or you can modify the country code and regions to use for other countries.

add_filter( 'woocommerce_states', 'custom_woocommerce_states' ); function custom_woocommerce_states( $states ) {$states['ES'] = array('ES1' => 'A Coruna','ES2' => 'Araba/Alava','ES3' => 'Albacete','ES4' => 'Alicante','ES5' => 'Almeria','ES6' => 'Asturias','ES7' => 'Avila','ES8' => 'Badajoz','ES9' => 'Baleares','ES10' => 'Barcelona','ES11' => 'Burgos','ES12' => 'Caceres','ES13' => 'Cadiz','ES14' => 'Cantabria','ES15' => 'Castellon','ES16' => 'Ceuta','ES17' => 'Ciudad Real','ES18' => 'Cordoba','ES19' => 'Cuenca','ES20' => 'El Hierro','ES21' => 'Fuerteventura','ES22' => 'Girona','ES23' => 'Gran Canaria','ES24' => 'Granada','ES25' => 'Guadalajara','ES26' => 'Gipuzkoa','ES27' => 'Huelva','ES28' => 'Huesca','ES29' => 'Ibiza','ES30' => 'Jaen','ES31' => 'La Gomera','ES32' => 'La Palma','ES33' => 'La Rioja','ES34' => 'Lanzarote','ES35' => 'Leon','ES36' => 'Lleida','ES37' => 'Lugo','ES38' => 'Madrid','ES39' => 'Majorca','ES40' => 'Malaga','ES41' => 'Melilla','ES42' => 'Menorca','ES43' => 'Murcia','ES44' => 'Navarra','ES45' => 'Ourense','ES46' => 'Palencia','ES47' => 'Pontevedra','ES48' => 'Salamanca','ES49' => 'Santa Cruz de Tenerife','ES50' => 'SegoviaSG','ES51' => 'Sevilla','ES52' => 'Soria','ES53' => 'Tarragona','ES54' => 'Tenerife','ES55' => 'Teruel','ES56' => 'Toledo','ES57' => 'Valencia','ES58' => 'Valladolid','ES59' => 'Bizkaia','ES60' => 'Zamora','ES61' => 'Zaragoza');return $states;}

Need a price for a new website instantly

Try our website cost calculator for free and get a price emailed to you.

One Comment

  • Self-Development says:

    Spot on with this write-up, I honestly believe this website needs a lot more attention. I’ll probably be returning to read through more, thanks for the advice!

Leave a Reply