How to Add Canary Island as a Country on Cart Page to get WooCommerce Shipping Rates

This is a business case related to requests from various customers using ELEX WooCommerce DHL Express / eCommerce / Paket Shipping Plugin with Print Label.

The problem

Shipping is an integral part of an eCommerce business and it can create hassles if your country is not listed in a leading WordPress eCommerce plugin, like WooCommerce. This business case is related to the exact same problem. One of our customers, who is using our DHL WooCommerce Plugin had reported that there is no field to select the country as Canary Island. Due to this, users on the customer’s website have to select Spain as a country and set the Canary Island zip code to get the shipping rates from DHL API. This was creating confusion for users and our client was losing a huge amount of business.

Arriving at a solution

As the problem was clear, the ELEX product development team came up with a solution very quickly to resolve the customer issue. With our solution, customers can easily select Canary Island as a country and ship freely everywhere with the DHL WooCommerce plugin.

In this case study, you will get to know how we helped our customers to ship using DHL to the Canary Island region without any trouble. Please see below screenshot where you can see that there is no country as Canary Island in the WooCommerce cart page.

As per the screenshot, we are not getting any search results for Canary Island, so we have added the below code snippet in the functions.php file of the theme folder to take Canary Island as a country in WooCommerce cart page to get live rates for DHL WooCommerce shipping.

add_filter( 'woocommerce_countries', 'elex_add_canary_island_to_woocommerce' );
function elex_add_canary_island_to_woocommerce( $countries ) {
$new_countries = array(
'IC' => __( 'Canary Island', 'woocommerce' ),
);
return array_merge( $countries, $new_countries );
}

After adding the code snippet, we can see Canary Island as a country option in the WooCommerce cart page to get the live rates for DHL shipping services. Please see below screenshot for better understanding:

This way, we have solved this critical DHL shipping case for our Canary Island customers. Now they are shipping successfully with our plugin.

Please visit the Product Page of ELEX WooCommerce DHL Express / eCommerce / Paket Shipping Plugin with Print Label to find the full set of features and capabilities.To know what our customers are talking about WooCommerce DHL shipping plugin, please check customer reviews.

2 Comments

  1. info1028
    Hi Dixit! Thanks for this snippet! It works, I can add the country in the "Sell to specific countries" list. However, it doesn't appear in the "Zone regions" of the "Shipping zones"... Any idea? Thanks Rémi
    • Dixit Shahji
      Hello Remi,Thanks for reaching out to us.We hope you liked our code snippet and helped you with shipping in the canary island.Regarding your query, As woocommerce doesn't consider Canary Island as a country, It's not possible to add in the zone regions.Let us know If you need any more shipping solutions.

Leave a Reply

WordPress Image Lightbox Plugin