Matrixrates: Filtering Based on Postal code or ZIP code

Overview

In some circumstances, it may be necessary to filter rates based on the postcode or ZIP code a customer is in. Matrixrates supports to forms of postal/ZIP code filtering:

Filter Type Function
Numeric With this, you specify ZIP code ranges e.g. 6000-8000, 9000-10000 to match on*
Pattern  Where the above methods are not appropriate you can use pattern matched filtering

The method you choose depends on your country’s location and postcode format in place.

Numeric Based Zipcodes

You can specify a range of zipcodes to match on. For example if you put a range from 3000 to 4000 if the customer enters their zipcode as 3500 it will match on this row.

Specifying a range of codes is most commonly used in Australia and USA. It is not suitable for use in the UK, Canada or any country with alphanumeric postal codes or postal codes that contain hyphens. These types of postal codes must be defined individually per row.

The following example shows usage when “Use Zip code Range to/From” is set to “Yes”

Please note that the Country column must be populated in order for zipcode matching to function.

Country Region/State City Zip From Zip to Weight From Weight To Shipping Price Delivery Type
Aus * * 0 20 15.00 Main Post
Aus * * 9766 9856 0 20 15.99 Main Post
Aus * * 9766 9856 0 20 9.50 Aus Courier1
Aus * * 9857 9899 0 29 12.50 Aus Courier2
Aus * * * * 0 10 50.00 Worldwide

 

Example Scenarios

Here are some scenarios with rates that would be shown if using the table above :

Input Criteria Output Rates
Australian buyer, zipcode 9770, total item weight of 3  9.50 – Aus Courier1
Australian buyer, zipcode 9878, total item weight of 3  12.50 – Aus Courier2
Australian buyer, zipcode 3000, weight 3  15.00 – Main Post
French buyer, total weight of 3  50.00 – Worldwide

Pattern-Based Filtering

The extension supports MySQL Pattern matching to allow for other types of post/zip code formats.  This method is also the only one supported by the free Matrix Rate extension for UK based customers.
There are 2 special characters:
Character Character name Function
% Percent Matches any number of alphanumerics thereafter
_ Underscore Matches one alphanumeric per underscore

To match all post/zip codes beginning with a sequence. i.e. to match any postcode beginning with 902 you would enter 902%.

Postcode/Zipcode Format Match
902% 902 postcode followed by a percent sign  would match all postcodes starting with 902
BT% BT postcode followed by a percent sign would match all Northern Ireland Postcodes
PO14% PO14 postcode followed by a percent sign  would match all postcodes starting with PO14

This is very powerful but doesn’t fit all circumstances.

Example Scenarios

For example, if you need to use UK postcodes and treat the postcode EH12 2JK differently from EH1 2LD then simply entering just EH12% would potentially match both if no space is present. This can be solved by creating rules using the underscore character “_” which represents one and only one character of any type per underscore used.

Character Character name Function
_ Underscore Matches one alphanumeric per underscore

So you would create a rule such as:

Postcode/Zipcode Format Match
EH12  ___  EH12 postcode entered with a space and 3 underscores would match all postcodes starting with EH12 followed by a space followed by 3 characters (one per underscore)
EH12___  EH12 postcode entered with 3 underscores (no spaces)  would match all postcodes starting with EH12 followed by 3 characters (one per underscore)
EH1  ___  EH1 postcode entered with a space and 3 underscores would match all postcodes starting with EH1 followed by a space followed by 3 characters (one per underscore)
EH1___  EH1 postcode entered with 3 underscores (no spaces)  would match all postcodes starting with EH1 followed by 3 characters (one per underscore)

This example shows usage with pattern matching:

Country Region/State City Zip From Zip to Weight >= Weight <= Shipping Price Delivery Type
GBR * * 0 5 2.99 1st Class Recorded
GBR * * 0 31.99 5.99 Parcelforce 24-48
GBR * * 32 1000 80 Special Pallet Delivery
GBR * London * 0 5 7.99 Parcelforce 24-48
GBR * Leeds * 0 32 9.99 Parcelforce 24-48
GBR * * 2000 2100 0 Collection only
GBR * BT% 0 5 11.99 1st Class Recorded
GBR * BT% 0 32 14.99 Parcelforce 24-48
GBR * PO1  ___ 0 5 8.99 Parcelforce 24-48
GBR * PO1___ 0 32 8.99 Parcelforce 24-48
GBR * PO14  ___ 0 5 6.99 Parcelforce 24-48
GBR * PO14___ 0 32 6.99 Parcelforce 24-48
IRL * * 0 32 17.99 Parcelforce 24-48
* * * 0 10 50 Worldwide

Here are some scenarios with rates that would be shown if using the table above:

Input Criteria Output Rates
GBR buyer, not from London, or with postcode starting BT, PO1, total item weight of 3  2.99 – 1st Class Recorded or 5.99 – ParcelForce 24-48
GBR buyer, postcode starts with BT, weight of 3  11.99 – 1st Class Recorded or 14.99 – ParcelForce 24-48
GBR buyer,  weight – 50  80.00 – Special Pallet Delivery
Ireland buyer,  weight – 15  17.99 – Irish Courier
French buyer, total weight of 3  50.00 – Worldwide
French buyer, total weight of 15  No options would be displayed
GBR buyer, total weight of 2040  0 – Collection only
GBR buyer, postcode entered as PO1  xxx or PO1xxx  weight 5  8.99 – ParcelForce 24-48
GBR buyer, postcode entered as PO14  xxx or PO14xxx  weight 5  6.99 – ParcelForce 24-48

Was this doc helpful?