During one of our latest e-commerce projects that we were developing for a client, we needed to implement different shipping options to account for the different pricing structures between shipping to Malta and Gozo.

It is a common request of course since the delivery fees for the business owners will vary, and in many cases, there will also be some operational differences as well. Therefore, since this is a very common requirement and there seem to be no easy guides on how to add this, we have decided to share the knowledge.

Step 1 – Install Code Snippets

From within your WordPress dashboard, click on Plugins > Add New

Search for “Code Snippets” and click on install.

Once Installed, you will need to click the blue Activate button.

Step 2 – Add the code

Don’t be alarmed, It’s gonna be super simple, promise. Once again, from your WordPress dashboard, navigate down to Snippets > Add New

On the next screen, you just need to add the details shown below, and press Save Changes and Activate. You do not need to write the code below manually, scroll below the image to find the code you can simply copy-paste.

 * Add a new country to countries list
add_filter( 'woocommerce_countries',  'stormdesign' );
function stormdesign( $countries ) {
  $new_countries = array(
	                    'GOZO'  => __( 'Gozo', 'woocommerce' ),

	return array_merge( $countries, $new_countries );

add_filter( 'woocommerce_continents', 'stormdesignmt' );
function stormdesignmt( $continents ) {
	$continents['EU']['countries'][] = 'GOZO';
	return $continents;

And that’s it – you are done!

No comment yet, add your voice below!

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.