How to add a United Arab Emirates city in WooCommerce?

How to add a United Arab Emirates city in WooCommerce
Author Bartosz Gajewski
Reading time:
2 minutes read

WooCommerce is a great solution for online shops but has its limitations. Shipping based on shipping zones and postcodes works well in most countries. But what if a country doesn’t have postcodes? In this article, you will learn how to add a United Arab Emirates city in WooCommerce.

The United Arab Emirates has no system of postal codes. Instead, they use registered PO Boxes, which are assigned individually. Other Gulf and Middle East countries also follow the same system. Shipping in WooCommerce is mainly based on postcodes, so shipping to individual cities in the UAE can be very problematic. Yes, in WooCommerce there is an option to choose the United Arab Emirates as a separate shipping zone. But what if the cost of shipping is different for different regions or cities? The best option is to add them yourself.

Would you like to find out more about shipping zones in WooCommerce – check out our ultimate guide

How to add a United Arab Emirates city in WooCommerce?

This is not about interfering with the WooCommerce code. The only thing that’s WooCommerce included is Countries and states/provinces for some countries. So we will use states to add cities. Especially since WooCommerce provides a filter named woocommerce_states that we can use.

All you have to do is to add a special code in the theme’s functions.php file or use an additional plugin like Code Snippets. Here’s an example code,  which I will cover in detail.

Basically, that code adds new states to WooCommerce. In my example, these are the biggest cities in the United Arab Emirates. You can also add new cities, just by adding new states. If you want to add Al Ain, just add a 'AA' => __( 'Al Ain', 'woocommerce' ) inside $states array.

How does it work?

It will add new states to the United Arab Emirates. This way, if you’ll go to WooCommerce > Settings > Shipping and add a new Shipping Zone, you will be able to select cities as a shipping zone.

United Arab Emirates cities in WooCommerce

The same will happen for your clients. On the checkout page or shopping cart, they will be able to select United Arab Emirates cities in the State / County dropdown field.

United Arab Emirates cities in the checkout page

Examples of usage

WooCommerce shipping to Dubai

If you want to offer shipping to only one city, like Dubai, you can add a Shipping Zone restricted to only that one city.

WooCommerce shipping to Dubai

Different shipping cost for each city

If you want to offer different shipping fees for each city, you can do it in two ways. First, you can add a separate shipping zone for each city and add a shipping method with a different fee inside all the zones. The second and much more convenient way is to use the Flexible Shipping Locations Add-on. It will allow you to configure it all in one shipping method.

United Arab Emirates cities in WooCommerce with Flexible Shipping Locations

Flexible Shipping Locations WooCommerce £29

Extend Flexible Shipping with custom locations and create shipping costs based on weight, order totals or item count.

Add to cart or View Details
Plugins used by 229,579+ shops
Last Updated: 2023-10-03
Works with WooCommerce 7.8 - 8.2.x
Notify of
Inline Feedbacks
View all comments
2 years ago

Thanks for the this snippet! it really helps!

However, some areas within UAE cities requires separate shipping fees. For an example:

City: Dubai
Dubai – Hatta to be 100
Dubai – Dubai Marina to be 10

How is that going to be achieved?

Łukasz Spryszak
Łukasz Spryszak
Reply to  Ta2Ta2
2 years ago

Hi Ta2Ta2, have you tried simply adding these areas as the separate locations the same way it was done in the snippet above?

27 days ago

Thanks for this, it really helped!

Last edited 27 days ago by Rashmi
Łukasz Spryszak
Łukasz Spryszak
Reply to  Rashmi
23 days ago

You’re welcome! It’s great to hear that you find it helpful.

Check out our case studies

Dream Home Story
Furniture shipping via WooCommerce – Dream Home’s Case Study

Learn how to configure custom shipping rules for furniture orders – from heavy and bulky to small and light.

4 minutes read
Vitrek’s Story

Read Octolize Case Study about Vitrek – a provider of innovative global solutions for High Voltage Test and Measurement.

2 minutes read
EnglishSpeakingMum’s Story

Read Octolize Case Study about EnglishSpeakingMum – Polish dedicated and involved parenting blogger.

2 minutes read

Join over 10,000 subscribers

Stay up to date and get WooCommerce tips & Octolize news right to your inbox!