How to Set Up Matrixrates that Filter Based on State/Region
Set regional shipping rates using state codes for customized pricing
Table of Contents
- Overview
- Default
- Best Match Filtering
- Multiple States
- Advanced Details
- Finding Out the Region Codes Used
Overview
This guide explains how to filter shipping rates based on the customer’s state or region. For instance, you might want to offer different rates to Alaska and Hawaii compared to the rest of the USA. This feature allows you to set such filters. 💡 You need to use region/state codes within Magento in your CSV file when filtering by states. In the USA, these correspond to the standard state codes (like CA, AK, HI, NY). For other countries, use the codes you've set up for taxes.
Default
Leave this field with a *
to include all undefined regions.
Best Match Filtering
The extension operates on a best match logic. If it finds matching rules for a state, it stops searching further.
Multiple States
Similar to Table Rates, state/region codes in Matrixrates must be specified in separate rows in the CSV, even if other filters and shipping prices are identical.
Advanced Details
Finding Out the Region Codes Used
Most users can skip this section and refer to examples instead. However, if needed, you can find the full list of region/state codes in the directory_country_region
database table. This step is useful if you want to add or remove military states, for example. Make sure you have regions available by checking the dropdown in the cart shipping estimator. If not, consider downloading the country's locale extension or defining these yourself if needed.
When inputting values in the region/state field from the CSV, they convert into numeric values before saving in the extension’s database table. Here’s how it works:
- No value in the region field saves as zero
- A value like "NSW" (or any other region) converts into its numeric value for the database, and is converted back to the state/region code when exporting the CSV. 😊