Royal Mail zones

Categories

Component ID

1712202

Component name

Royal Mail zones

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

1113

Component created

Component changed

Component body

The UK's Royal Mail categorises destinations as falling into four zones across the world: the UK, Europe, world zone 1, and world zone 2. The Royal Mail zones module makes it easy to check which zone a country's in. Note that by this definition the UK isn't in Europe, which might seem counter-intuitive at first.

This module doesn't

  • integrate with any Royal Mail APIs (if there are any);
  • provide Royal Mail shipping pricing rules.

Rules

There are two Rule conditions provided:

  1. Country is in Royal Mail zone: This takes the country and zone as text inputs.
  2. Order address is in Royal Mail zone: This takes the country, a Commerce Order, and the address you're interested in (eg. shipping). Requires Commerce.

API

All countries are specified as two letter ISO 3166-1 alpha-2 country codes (eg. GB). The following test functions all accept a country code and return a boolean value.

module_load_include('inc', 'rmzone');
rmzone_country_in_uk($country);
rmzone_country_in_europe($country);
rmzone_country_in_world_zone_1($country);
rmzone_country_in_world_zone_2($country);
rmzone_country_in_zone($country, $zone);

The following function returns the zone of the given country, where the zone is one of:

  • uk
  • europe
  • world zone 1
  • world zone 2
module_load_include('inc', 'rmzone');
rmzone_country_get_zone($country);

The following funtions all return an array with matching key value pairs of country codes.

module_load_include('inc', 'rmzone');
rmzone_countries_uk();
rmzone_countries_europe();
rmzone_countries_world_zone_1();
rmzone_countries_world_zone_2();