How to Add Iraq Provinces and Cities in WooCommerce Checkout (Without ZIP Codes)

Planet Volumes RxM4LFPBiE8 Unsplash
Author Jakub Pawlik
Updated:
2026-09-10
Reading time:
4 minutes read

WooCommerce is a powerful e-commerce platform, but it also has some limitations. Shipping based on shipping zones and postcodes works well in most countries. But what if you run a store in a country without ZIP codes? In this article, you will learn how to add Iraq provinces (governorates) into WooCommerce checkout as a dropdown list.

Iraq has no unified ZIP code system. Instead, customers usually just write their province or city name, which leads to many spelling variations and makes shipping rules unreliable. By default, WooCommerce lets you choose “Iraq” as a shipping zone, but there is no built-in list of provinces. And what if the cost of delivery differs between Baghdad, Erbil, or Basra? The best solution is to add provinces yourself.

Would you like to find out more about shipping zones in WooCommerce? Check out our ultimate guide

TL;DR

  1. Problem: no province list for Iraq in WooCommerce, no ZIP codes to substitute – free-text city names make shipping rules unreliable.
  2. Fix: a woocommerce_states filter snippet in functions.php or via the Code Snippets plugin. No core files touched.
  3. Result: a dropdown in the State / County field, and provinces selectable in Shipping Zones.
  4. Per-province pricing: one zone per province, or all rates in one method with Flexible Shipping Locations.
  5. Portable: swap the country code and region list to do the same for any country.

How to add Iraq provinces in WooCommerce?

All you need to do is paste a short snippet into your theme’s functions.php file or use a plugin like Code Snippets. We won’t touch WooCommerce core code. The only thing WooCommerce provides by default are countries and states/provinces for some regions. Luckily, WooCommerce has a filter called woocommerce_states, which we can use to add Iraq’s governorates.

Here’s an example code:


add_filter( 'woocommerce_states', 'fs_add_iraq_governorates' );
function fs_add_iraq_governorates( $states ) {
    $states['IQ'] = array(
        'AN' => __( 'Al Anbar', 'woocommerce' ),
        'BA' => __( 'Babil', 'woocommerce' ),
        'BG' => __( 'Baghdad', 'woocommerce' ),
        'QA' => __( 'Qadisiyyah (Diwaniyah)', 'woocommerce' ),
        'NA' => __( 'Najaf', 'woocommerce' ),
        'KA' => __( 'Karbala', 'woocommerce' ),
        'WA' => __( 'Wasit', 'woocommerce' ),
        'MS' => __( 'Maysan', 'woocommerce' ),
        'MU' => __( 'Muthanna', 'woocommerce' ),
        'DQ' => __( 'Dhi Qar (Nasiriyah)', 'woocommerce' ),
        'BAA'=> __( 'Basra', 'woocommerce' ),
        'SD' => __( 'Salah ad Din', 'woocommerce' ),
        'DY' => __( 'Diyala', 'woocommerce' ),
        'NI' => __( 'Nineveh (Mosul)', 'woocommerce' ),
        'KR' => __( 'Kirkuk (Taʼmim)', 'woocommerce' ),
        'DA' => __( 'Duhok', 'woocommerce' ),
        'AR' => __( 'Erbil (Hewlêr)', 'woocommerce' ),
        'SU' => __( 'Sulaymaniyah (Slemani)', 'woocommerce' ),
        'HB' => __( 'Halabja', 'woocommerce' ),
    );
    return $states;
}

This snippet adds Iraq’s 19 provinces. If you want to extend the list later (e.g., add specific districts or cities), just insert additional entries into the $states array.

Not sure how to apply this snippet to your store? Read our full guide on adding custom code to WooCommerce to make sure you do it safely and efficiently.

How does it work?

It will add all Iraq provinces to WooCommerce. Then, when you go to WooCommerce → Settings → Shipping and add a new Shipping Zone, you’ll be able to assign rules to individual provinces.

Iraq provinces in WooCommerce

Your customers will see the same improvement on the checkout page. Instead of typing freely, they will be able to select their province from the dropdown menu in the State / County field.

Iraq provinces in the WooCommerce checkout

Examples of usage

WooCommerce shipping to Baghdad

If you want to restrict shipping to only one province — e.g., Baghdad — simply create a Shipping Zone limited to Baghdad and assign methods and rates just for that area.

WooCommerce shipping to Baghdad

Different shipping cost for each province

If you want to set different delivery fees depending on the province (for example, $5 for Baghdad, $8 for Basra, $10 for Nineveh), you can do it in two ways:

Create a separate Shipping Zone for each province and assign a method with its own rate.

Use the Flexible Shipping Locations add-on. This will allow you to configure all rates inside a single shipping method, which is much easier to maintain. You can use it only with the Flexible Shipping method available in both the free version and the PRO version.

Iraq provinces in WooCommerce with Flexible Shipping Locations

Flexible Shipping Locations WooCommerce
39.00

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

View DetailsorAdd to cart
Plugins used by 235,679+ shops
30-day money back guarantee
Last Updated: 2026-09-21
Works with WooCommerce 10.8 - 11.2.x

Can I add provinces or regions for other countries the same way?

Yes. This method works not only for Iraq but also for any other country. You simply need to adjust the snippet to match the country code and provide the list of regions you want to add. After that, they will appear in the WooCommerce Shipping Zones and at the checkout just like in the example above.

FAQ

Will the snippet disappear after an update?

  • It depends where you put it. Code added to a theme’s functions.php is lost when the theme updates, unless you’re using a child theme. A snippets plugin or a small site-specific plugin survives both theme and WooCommerce updates, which is why it’s the safer option for anything you rely on for shipping.

Does this work with the new block-based checkout?

  • Yes. The woocommerce_states filter operates on WooCommerce’s country and state data, not on a particular checkout template, so the dropdown appears in both the classic checkout and the Cart and Checkout blocks.

What happens to orders placed before I added the provinces?

  • Nothing changes for them. Old orders keep whatever text the customer typed into the state field, so a store that has been running for a while will hold both free-text values and the new codes. Keep this in mind if you report on shipping by region – a query written against the new codes will silently miss the older orders.

Can I add cities or districts instead of provinces?

  • Yes, the same array takes any level of granularity you want – you can list districts of Baghdad rather than governorates, or mix both.

Does this method work for other countries without postcodes?

  • Yes. Change the country code in the array from IQ to the one you need and supply that country’s subdivisions. The regions then appear in Shipping Zones and at checkout the same way, which makes this the general fix for any country WooCommerce ships without a state list.
Comments
Subscribe
Notify of
guest
0 Comments

Check out our case studies

Kurzgesagt x Octolize Shipping Rates Rules & Zones Shopify app case study
Kurzgesagt

Learn how Octolize helped Kurzgesagt, the online shop behind one of YouTube’s most popular science channels, set up conditional courier rules using the Shopify Shipping Rates Rules & Zones app.

Castle Sefton Press featured image
Castle Sefton Press

Learn how Octolize solutions helped WooCommerce store based in the United Kingdom set up shipping scenarios.

Case study Metuchen
Metuchen Mower

Learn how Octolize helped Shopify store based in the USA set up distance based rates with a usage of Octolize Distance Based Rates.