Symfony/Configure countries regions states

From Aimeos documentation

Symfony
Other languages:
English 100%


Countries

If you want to ship your products to several countries or you need to know from which countries your customers are, you have to enable the country selection in the address page of the checkout process.

By default, the country list is hidden for the billing and delivery address in the checkout process. To make show them and make them mandatory you need to add "order.base.address.countryid" to the list of values defined in

In Symfony this is configured for billing and delivery addresses via the YAML configuration:

  1. aimeos_shop:
  2.     client:
  3.         html:
  4.             checkout:
  5.                 standard:
  6.                     address:
  7.                         billing:
  8.                             mandatory:
  9.                                 - order.base.address.salutation
  10.                                 - order.base.address.firstname
  11.                                 - order.base.address.lastname
  12.                                 - order.base.address.address1
  13.                                 - order.base.address.postal
  14.                                 - order.base.address.city
  15.                                 - order.base.address.languageid
  16.                                 - order.base.address.email
  17.                                 - order.base.address.countryid
  18.                         delivery:
  19.                             mandatory:
  20.                                 - order.base.address.salutation
  21.                                 - order.base.address.firstname
  22.                                 - order.base.address.lastname
  23.                                 - order.base.address.address1
  24.                                 - order.base.address.postal
  25.                                 - order.base.address.city
  26.                                 - order.base.address.languageid
  27.                                 - order.base.address.email
  28.                                 - order.base.address.countryid

If no selection should be enforced, you can use instead

To make the country for billing and delivery addresses optional, use this configuration:

  1. aimeos_shop:
  2.     client:
  3.         html:
  4.             checkout:
  5.                 standard:
  6.                     address:
  7.                         billing:
  8.                             optional:
  9.                                 # ... other optional fields ...
  10.                                 - order.base.address.countryid
  11.                         delivery:
  12.                             optional:
  13.                                 # ... other optional fields ...
  14.                                 - order.base.address.countryid

The list of countries is defined by the values added to the configuration key client/html/checkout/standard/address/countries. The configuration below will add all countries worldwide to the select boxes for the billing and delivery address:

  1. aimeos_shop:
  2.     client:
  3.         html:
  4.             checkout:
  5.                 standard:
  6.                     address:
  7.                         countries:
  8.                             - AD # Andorra
  9.                             - AE # United Arab Emirates
  10.                             - AF # Afghanistan
  11.                             - AG # Antigua and Barbuda
  12.                             - AI # Anguilla
  13.                             - AL # Albania
  14.                             - AM # Armenia
  15.                             - AO # Angola
  16.                             - AQ # Antarctica
  17.                             - AR # Argentina
  18.                             - AS # American Samoa
  19.                             - AT # Austria
  20.                             - AU # Australia
  21.                             - AW # Aruba
  22.                             - AX # Åland Islands
  23.                             - AZ # Azerbaijan
  24.                             - BA # Bosnia and Herzegovina
  25.                             - BB # Barbados
  26.                             - BD # Bangladesh
  27.                             - BE # Belgium
  28.                             - BF # Burkina Faso
  29.                             - BG # Bulgaria
  30.                             - BH # Bahrain
  31.                             - BI # Burundi
  32.                             - BJ # Benin
  33.                             - BL # Saint Barthélemy
  34.                             - BM # Bermuda
  35.                             - BN # Brunei Darussalam
  36.                             - BO # Bolivia, Plurinational State of
  37.                             - BQ # Bonaire, Sint Eustatius and Saba
  38.                             - BR # Brazil
  39.                             - BS # Bahamas
  40.                             - BT # Bhutan
  41.                             - BV # Bouvet Island
  42.                             - BW # Botswana
  43.                             - BY # Belarus
  44.                             - BZ # Belize
  45.                             - CA # Canada
  46.                             - CC # Cocos (Keeling) Islands
  47.                             - CD # Congo, the Democratic Republic of the
  48.                             - CF # Central African Republic
  49.                             - CG # Congo
  50.                             - CH # Switzerland
  51.                             - CI # Côte d'Ivoire
  52.                             - CK # Cook Islands
  53.                             - CL # Chile
  54.                             - CM # Cameroon
  55.                             - CN # China
  56.                             - CO # Colombia
  57.                             - CR # Costa Rica
  58.                             - CU # Cuba
  59.                             - CV # Cape Verde
  60.                             - CW # Curaçao
  61.                             - CX # Christmas Island
  62.                             - CY # Cyprus
  63.                             - CZ # Czech Republic
  64.                             - DE # Germany
  65.                             - DJ # Djibouti
  66.                             - DK # Denmark
  67.                             - DM # Dominica
  68.                             - DO # Dominican Republic
  69.                             - DZ # Algeria
  70.                             - EC # Ecuador
  71.                             - EE # Estonia
  72.                             - EG # Egypt
  73.                             - EH # Western Sahara
  74.                             - ER # Eritrea
  75.                             - ES # Spain
  76.                             - ET # Ethiopia
  77.                             - FI # Finland
  78.                             - FJ # Fiji
  79.                             - FK # Falkland Islands (Malvinas)
  80.                             - FM # Micronesia, Federated States of
  81.                             - FO # Faroe Islands
  82.                             - FR # France
  83.                             - GA # Gabon
  84.                             - GB # United Kingdom
  85.                             - GD # Grenada
  86.                             - GE # Georgia
  87.                             - GF # French Guiana
  88.                             - GG # Guernsey
  89.                             - GH # Ghana
  90.                             - GI # Gibraltar
  91.                             - GL # Greenland
  92.                             - GM # Gambia
  93.                             - GN # Guinea
  94.                             - GP # Guadeloupe
  95.                             - GQ # Equatorial Guinea
  96.                             - GR # Greece
  97.                             - GS # South Georgia and the South Sandwich Islands
  98.                             - GT # Guatemala
  99.                             - GU # Guam
  100.                             - GW # Guinea-Bissau
  101.                             - GY # Guyana
  102.                             - HK # Hong Kong
  103.                             - HM # Heard Island and McDonald Islands
  104.                             - HN # Honduras
  105.                             - HR # Croatia
  106.                             - HT # Haiti
  107.                             - HU # Hungary
  108.                             - ID # Indonesia
  109.                             - IE # Ireland
  110.                             - IL # Israel
  111.                             - IM # Isle of Man
  112.                             - IN # India
  113.                             - IO # British Indian Ocean Territory
  114.                             - IQ # Iraq
  115.                             - IR # Iran, Islamic Republic of
  116.                             - IS # Iceland
  117.                             - IT # Italy
  118.                             - JE # Jersey
  119.                             - JM # Jamaica
  120.                             - JO # Jordan
  121.                             - JP # Japan
  122.                             - KE # Kenya
  123.                             - KG # Kyrgyzstan
  124.                             - KH # Cambodia
  125.                             - KI # Kiribati
  126.                             - KM # Comoros
  127.                             - KN # Saint Kitts and Nevis
  128.                             - KP # Korea, Democratic People's Republic of
  129.                             - KR # Korea, Republic of
  130.                             - KW # Kuwait
  131.                             - KY # Cayman Islands
  132.                             - KZ # Kazakhstan
  133.                             - LA # Lao People's Democratic Republic
  134.                             - LB # Lebanon
  135.                             - LC # Saint Lucia
  136.                             - LI # Liechtenstein
  137.                             - LK # Sri Lanka
  138.                             - LR # Liberia
  139.                             - LS # Lesotho
  140.                             - LT # Lithuania
  141.                             - LU # Luxembourg
  142.                             - LV # Latvia
  143.                             - LY # Libya
  144.                             - MA # Morocco
  145.                             - MC # Monaco
  146.                             - MD # Moldova, Republic of
  147.                             - ME # Montenegro
  148.                             - MF # Saint Martin (French part)
  149.                             - MG # Madagascar
  150.                             - MH # Marshall Islands
  151.                             - MK # Macedonia
  152.                             - ML # Mali
  153.                             - MM # Myanmar
  154.                             - MN # Mongolia
  155.                             - MO # Macao
  156.                             - MP # Northern Mariana Islands
  157.                             - MQ # Martinique
  158.                             - MR # Mauritania
  159.                             - MS # Montserrat
  160.                             - MT # Malta
  161.                             - MU # Mauritius
  162.                             - MV # Maldives
  163.                             - MW # Malawi
  164.                             - MX # Mexico
  165.                             - MY # Malaysia
  166.                             - MZ # Mozambique
  167.                             - NA # Namibia
  168.                             - NC # New Caledonia
  169.                             - NE # Niger
  170.                             - NF # Norfolk Island
  171.                             - NG # Nigeria
  172.                             - NI # Nicaragua
  173.                             - NL # Netherlands
  174.                             - NO # Norway
  175.                             - NP # Nepal
  176.                             - NR # Nauru
  177.                             - NU # Niue
  178.                             - NZ # New Zealand
  179.                             - OM # Oman
  180.                             - PA # Panama
  181.                             - PE # Peru
  182.                             - PF # French Polynesia
  183.                             - PG # Papua New Guinea
  184.                             - PH # Philippines
  185.                             - PK # Pakistan
  186.                             - PL # Poland
  187.                             - PM # Saint Pierre and Miquelon
  188.                             - PN # Pitcairn
  189.                             - PR # Puerto Rico
  190.                             - PS # Palestine, State of
  191.                             - PT # Portugal
  192.                             - PW # Palau
  193.                             - PY # Paraguay
  194.                             - QA # Qatar
  195.                             - RE # Réunion
  196.                             - RO # Romania
  197.                             - RS # Serbia
  198.                             - RU # Russian Federation
  199.                             - RW # Rwanda
  200.                             - SA # Saudi Arabia
  201.                             - SB # Solomon Islands
  202.                             - SC # Seychelles
  203.                             - SD # Sudan
  204.                             - SE # Sweden
  205.                             - SG # Singapore
  206.                             - SH # Saint Helena, Ascension and Tristan da Cunha
  207.                             - SI # Slovenia
  208.                             - SJ # Svalbard and Jan Mayen
  209.                             - SK # Slovakia
  210.                             - SL # Sierra Leone
  211.                             - SM # San Marino
  212.                             - SN # Senegal
  213.                             - SO # Somalia
  214.                             - SR # Suriname
  215.                             - SS # South Sudan
  216.                             - ST # Sao Tome and Principe
  217.                             - SV # El Salvador
  218.                             - SX # Sint Maarten (Dutch part)
  219.                             - SY # Syrian Arab Republic
  220.                             - SZ # Swaziland
  221.                             - TC # Turks and Caicos Islands
  222.                             - TD # Chad
  223.                             - TF # French Southern Territories
  224.                             - TG # Togo
  225.                             - TH # Thailand
  226.                             - TJ # Tajikistan
  227.                             - TK # Tokelau
  228.                             - TL # Timor-Leste
  229.                             - TM # Turkmenistan
  230.                             - TN # Tunisia
  231.                             - TO # Tonga
  232.                             - TR # Turkey
  233.                             - TT # Trinidad and Tobago
  234.                             - TV # Tuvalu
  235.                             - TW # Taiwan
  236.                             - TZ # Tanzania, United Republic of
  237.                             - UA # Ukraine
  238.                             - UG # Uganda
  239.                             - UM # United States Minor Outlying Islands
  240.                             - US # United States
  241.                             - UY # Uruguay
  242.                             - UZ # Uzbekistan
  243.                             - VA # Vatican City State (Holy See)
  244.                             - VC # Saint Vincent and the Grenadines
  245.                             - VE # Venezuela, Bolivarian Republic of
  246.                             - VG # Virgin Islands, British
  247.                             - VI # Virgin Islands, U.S.
  248.                             - VN # Viet Nam
  249.                             - VU # Vanuatu
  250.                             - WF # Wallis and Futuna
  251.                             - WS # Samoa
  252.                             - YE # Yemen
  253.                             - YT # Mayotte
  254.                             - ZA # South Africa
  255.                             - ZM # Zambia
  256.                             - ZW # Zimbabwe

States and Regions

For each country you can freely define a list of states or regions that can be used afterwards to calculate the final price for each delivery option.

To define states or regions via the configuration use something like this:

  1. aimeos_shop:
  2.     client:
  3.         html:
  4.             checkout:
  5.                 standard:
  6.                     address:
  7.                         states:
  8.                             US:
  9.                                 CA: California
  10.                                 NY: New York
  11.                                 # ...
  12.                             EU:
  13.                             W: Western Europe
  14.                                 C: Central Europe
  15.                                 # ...

The key you have chosen for the state or region will be stored in the order address of the customer and can then be used during the rest of the checkout process. More details can be found in the documentation of the configuration option: