Matrixrates: Filtering Based on Postal code or ZIP code
Set up postal code-based shipping rate filters using numeric or pattern matching methods
Table of Contents
- Overview
- Numeric-Based ZIP Codes
- Example Table
- Example Scenarios
- Pattern-Based Filtering
- Pattern Matching Examples
- Example Scenarios with Pattern Matching
- Example Pattern Matching Table
- Pattern-Based Example Scenarios
Overview
Filtering shipping rates by postal or ZIP code can be essential in some scenarios. Matrixrates allows filtering using two methods:
- Numeric-based filtering: Specify ZIP code ranges to match customer entries.
- Pattern-based filtering: Use pattern matching for more complex postal code formats.
The choice depends on your country's format and location.
Numeric-Based ZIP Codes
You can define a range of ZIP codes to match entries easily. For instance, if you set a range from 3000 to 4000, a customer's ZIP code of 3500 will match within this range.
This method is common in countries like Australia and the USA but not suitable for places with alphanumeric codes like the UK and Canada, where each code needs individual input.
Here's how you can use numeric-based filtering:
- Set "Use ZIP Code Range To/From" to "Yes."
- The country column must be filled for correct functioning.
Example Table
```plaintext
Example Scenarios
- Australian buyer, ZIP code 9770, total item weight of 3: 9.50 – Aus Courier1
- Australian buyer, ZIP code 9878, total item weight of 3: 12.50 – Aus Courier2
- Australian buyer, ZIP code 3000, weight 3: 15.00 – Main Post
- French buyer, total weight of 3: 50.00 – Worldwide
Pattern-Based Filtering
Matrixrates supports MySQL pattern matching for more complex postal formats. This method is essential for UK-based customers using the free Matrix Rate extension. Here are two special characters used:
%
: Matches any number of alphanumerics_
: Matches exactly one alphanumeric per underscore
To find all codes starting with a sequence, such as any postcode beginning with '902', input '902%'.
Pattern Matching Examples
```plaintext
Example Scenarios with Pattern Matching
To treat UK postcodes like EH12 2JK differently from EH1 2LD, use underscores (_
) to create precise matches. Here's how:
```plaintext
Example Pattern Matching Table
```plaintext
Pattern-Based Example Scenarios
- GBR buyer, not from London, starting with BT, PO1, weight 3: 2.99 - 1st Class Recorded or 5.99 - ParcelForce 24-48
- GBR buyer, postcode starts with BT, weight 3: 11.99 - 1st Class Recorded or 14.99 - ParcelForce 24-48
- French buyer, weight 15: No options available
- GBR buyer, total weight 2040: 0 - Collection only