Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Create and assign countries and states

Describes how to create a country and state, and assign those to a website in the Optimizely Configured Commerce SDK.

Create a country

Creating and assigning a country in the Admin Console allows users to edit basic country information and allows the system to use that country for shipping orders. The user can also create new countries if necessary. Below are the steps for creating a new country and populating the corresponding fields to make it active. In this scenario, the user has just started to operate business in Australia.

  1. Go to Admin Console > Administration > Localization > Countries.
  2. Click Add Country.
  3. Enter the Country's name in the Name field.
  4. Enter the Country's abbreviation in the Abbreviation field. This abbreviation should be the same as the ISO alpha-2 Code, which is used in the next field.
  5. Enter the two letter code in the ISO alpha-2 Code field.
  6. Enter the two letter code in the ISO alpha-3 Code field.
  7. Enter the three digit ISO number in the ISO Number field.
  8. Chose the correct measurement system in the Distance Unit of Measure field drop-down menu.
  9. Click the Active toggle to indicate whether this country is active or not.
  10. Set the Block Anonymous Traffic toggle to YES to identify traffic by IP address from this country and then redirect it to the login page, if not authenticated. Using this setting helps prevent people (or bad actors) from countries you don't sell in from accessing your site, for example to scrape product and pricing information for their own purposes.

Now that the country has been created, it needs to be applied to a corresponding website. If the country is already active and only modifications to the country were made, saving the content by accepting changes is sufficient. Below are the steps to assigning a country to a website.

Assign a country to a website

  1. Go to Admin Console > Websites.
  2. Click Edit for the desired country.
  3. Click the Country finger tab.
  4. Click Assign Countries.
  5. Search for the desired country, select it and click Assign, and click Done.
  6. Click Save.

Create a state

Creating and assigning states in the Admin Console allows users to modify tax and handling information for each state. The user can also create new states if necessary. Below are the steps for creating a new state and populating the corresponding fields to make it active. In this scenario, the user has just started to operate business in Queensland, Australia.

As a point of reference, States are created within the Countries entity and then assigned within the Website entity.

  1. Go to Admin Console > Administration > Localization > Countries.
  2. Click Edit for the desired Country.
  3. Click the States finger tab.
  4. Click Add States.

State details

  1. In the Name field, enter the state's name.

  2. Enter the Abbreviation for the state. The abbreviation should be the alpha postal code.

  3. Click Active to indicate Yes or No.

Tax information

  1. Click Taxable to have the tax information go active.

  2. Enter the Tax Code for the state. The tax code entered needs to correspond with the initial setup in the ERP. Generally, the tax code will be the same as the abbreviation code.

  3. Enter the Tax Rate for the state.

    The state tax rate does not include local taxes. The tax rate will apply to all products in this state.

    Click Tax Freight to tax freight from this state.

  4. Enter a Handling Amount if needed. The handling amount is a global amount that would be collected from each customer in the state.

  5. Click Save.

Now that the state has been created, it needs to be applied to a corresponding website, even if there is only one website. Below are the steps to assigning a state to a website.

Assign a state to a website

  1. Go to Admin Console > Websites .
  2. Click Edit for the desired Website.
  3. Click the States finger tab.
  4. Click Assign States.
  5. Search for and select the desired state.
  6. Click Assign and then click Done.
  7. Click Save.