How to Set Up Matrixrates that Filter Based on State/Region

Overview

This document goes through how to optionally filter your rates based on the state/region that the customer is in. For example, you might want to offer different rates to Alaska and Hawaii than you do for the rest of USA.  This filter allows you to do that.

Note: You must use the region/state codes within Magento in your CSV file when filtering on regions/states.  In the USA these match the standard state codes (e.g. CA, AK, HI, NY). Elsewhere you should be aware of the codes as you have probably used in your tax setup.

Default

This field can be left with a * which means include all undefined.

Best Match Filtering

As the extension works based on the best match if it finds a set of rules that match for the state then it will stop searching.

Multiple States

Similarly to Table Rates, state/region codes within Matrixrates must be defined on their own row in the CSV, even if the other filters and shipping price are the same.

Advanced Details

Finding out the region codes used

For most of our customers you can skip this section and look at examples.

If you look in directory_country_region database table you will get the full list of region/state codes used.  If you want to, for example, add or remove some of the military states then you can do by modifying this table.

Firstly check you have regions – these can be seen in the drop down on the cart shipping estimator.  If you don’t then try downloading the country’s locale extension, otherwise you may need to define yourself (if you wish to use).

Note that the values in the region/ state field from the CSV are converted into numeric values before they are saved in the extension’s table within the database. For example:

  • If there is no value in region filed, it gets save as zero
  • If there is value, for example, “NSW” (or any region in that filed) then it will convert the value into its numeric value and save into the database. When export the CSV that value gets converted back to the state/region code.

 

Was this doc helpful?