Filtering Based on Postcode/Zipcode

In some circumstances it may be necessary to filter rates based on the postcode or zipcode a customer is in. Our extensions support several different methods for filtering based on zipcode:

Filter Type Function Supported Extensions
Numeric With this you specify zipcode ranges e.g. 6000-8000, 9000-10000 to match on All
Pattern  Where the above methods are not appropriate you can use pattern matched filtering All
UK This was specifically developed for the UK market and allows you to specify the start of the postcode e.g. PA25, E1, etc. NB: Does not support ranges (please see below). Paid
Canada Specifically developed for the Canadian market and allows you to specify the start of the postcode e.g. A0A Paid

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

Note: UK based filtering is not supported in the free Matrix Rates extension. It is supported in all paid extensions (except Shipping Override), and we strongly recommend customers upgrade to the Premium Matrix Rate extension if they need to filter based on postcodes; otherwise, their CSV file will be large and difficult to maintain.

With all the paid WebShopApps extensions you can put any combination of multiple countries, states, or postcodes on one line.

Examples where this is useful:

  • Specify rates for all of Europe in one set e.g. ITA, FRA, DEU …
  • Specify exemption rates for Alaska, Hawaii e.g. AK, HI
  • Specify UK postcodes, e.g. BT%, IM%, GE%
Please note that the Country column must be populated in order for ZIP/Postal code matching to function.

Numeric Based Zipcodes

This approach is most commonly used in Australia and USA. It is not suitable for use in the UK or Canada.

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.

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

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

 

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

Advanced Options with Numeric Zipcodes

The ProductMatrix  extension allows you to shorten the zipcode length entered and then use this shorterned code for matching.  This has been found to be useful in countries such as the Netherlands.  For example you may have a zipcode range set to 100-300, but the zipcode itself might be 1109A. You can match on this by setting the max length to 3. It would then match on 110.  Likewise you can do this where there is a 2 part code e.g. 10000-5467 could be shortened by specifying max length as 5.

In Brazil if no max length is specified the logic in ProductMatrix will join a 2-part zipcode together e.g. 10000-1000 will become 100001000 for searching purposes.

In the US if no max length is specified the logic in ProductMatrix will use just the first part of the zipcode e.g. 10000-1000 will become 10000.

UK Based Postcodes

Use UK based filtering if working on UK postcodes.

The filtering works by looking at the first part of a postcode.

Note that the whole postcode must be entered on the cart/checkout (for example, “SS1 1AA”, rather than “SS1″) – the extension will take the prefix of the postcode entered.

Let’s take the following examples:

Postcode Will match on
SS9 4JQ SS9
E1 4RT E1
PA25 4ER PA25
PA2 8ER PA2

The extension is intelligent enough to see that these postcodes need to match on SS9, E1, PA25 and PA2 respectively.

Please note: UK postcodes do not support ranges. To define SS1-SS9, for example, each number will need to be specified: SS1,SS2,SS3, etc. For all SS postcodes, however, “SS” can be used instead.

When in the UK we recommend you use UK postcode filtering if available.

This feature is not supported in the free Matrix Rate extension, we strongly recommend you purchase the Premium version or the even more powerful Product Matrix Extension if you wish to use postcode filtering in the UK.

WC postcodes – these are a special set of postcodes in London. They must be entered into your CSV in the following manner WC1A, WC1B etc…

An example of the format for filtering is shown in Product Matrix.

Note: In the Shipping Method configuration there are settings you will need to select to setup UK Based Postcode Filtering

Setting Set switch to
Use UK Postcode filtering This must be set to YES.
Use Zip code range This must be set to NO. If it is not then you will not see the results you desire as UK postcodes do not work with ranges.

 

Canada Based Postcodes

Use Canada based filtering if working on Canadian postcodes. The filtering works by looking at the first part of a postcode and matching this on the range specified in the csv file.

You specify in the zip from column the starting range e.g. A0A. In the zip to column specify the end range e.g. A8A. It will then match on all postcodes that start with A from 0A to 8A, so for instance A0Z would match, A7G would match, etc. 

This feature is not supported in the free Matrix Rate extension, only the Premium version and Product Matrix.

All other types of Postcodes: 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 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 requirements.

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 when “Use Zip code Range To/From” is set to “No” and you are just pattern matching:

Country Region/State City Zip From Zip to Weight From Weight To 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
0 votes

Leave a Reply

Featuring WPMU Bloglist Widget by YD WordPress Developer