> For the complete documentation index, see [llms.txt](https://responsive-media.gitbook.io/advanced-free-shipping/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://responsive-media.gitbook.io/advanced-free-shipping/conditions-location/postcode-zip.md).

# Postcode/ZIP

## Overview

The **Postcode/ZIP** condition applies discounts based on the postal code or ZIP code in the shipping address. This is the most granular location targeting available, perfect for hyper-local promotions.

{% hint style="info" %}
This condition supports exact matches, wildcard patterns, and ranges for flexible targeting.
{% endhint %}

## Available Operators

* **Matches any of**: Postcode matches at least one of your patterns.
* **Does not match**: Postcode does NOT match any of your patterns.

## Pattern Types

### 1. Exact Match

Match specific postal codes exactly:

```
94107
10001
M5H 2N2
```

**Use case**: Target specific neighborhoods or buildings.

### 2. Wildcard Patterns

Use `*` as a wildcard to match multiple codes:

```
941*     → Matches 94100:94199 (San Francisco area)
M5*      → Matches all M5x codes (Toronto downtown)
SW1*     → Matches all SW1 codes (London Westminster)
```

**Use case**: Target entire regions or districts.

### 3. Ranges

Use `:` to specify ranges:

```
94100:94199    → All codes from 94100 to 94199
10000:10999    → All Manhattan ZIP codes
```

**Use case**: Target contiguous postal code areas.

### 4. Combining Patterns

Enter multiple patterns (one per line or comma-separated):

```
94107, 94110, 94112
941*, 942*
94100:94199, 95000:95999
```

## Common Use Cases

### Local Delivery Zone

**Free shipping within your delivery area**

**Configuration**:

* Condition: Postcode **matches any of** 94107, 94110, 94112, 94114
* Discount: Free shipping

**Use case**: Local businesses offering free delivery nearby.

### City-Wide Free Shipping

**Free shipping for all of San Francisco**

**Configuration**:

* Condition: Postcode **matches any of** 941\*
* Discount: Free shipping

**Use case**: Target an entire city or metro area.

### Exclude Rural Areas

**Free shipping except rural postal codes**

**Configuration**:

* Condition 1: Country **is one of** US
* Condition 2: Postcode **does not match** 995\*, 996\*, 997\*, 998\*, 999\*
* Discount: Free shipping

**Use case**: Exclude expensive rural delivery areas.

### Multiple City Promotion

**Free shipping for major cities**

**Configuration**:

* Condition: Postcode **matches any of**
  * 941\* (San Francisco)
  * 900\* (Los Angeles)
  * 100\* (New York)
  * 606\* (Chicago)
* Discount: Free shipping

## Examples by Country

{% tabs %}
{% tab title="United States (ZIP)" %}
**Format**: 5 digits (e.g., 94107)

**Examples**:

* Exact: `94107`
* Wildcard: `941*` (all 941xx codes)
* Range: `94100:94199`

**Common patterns**:

* Manhattan: `100*-109*`
* Los Angeles: `900*-908*`
* Chicago: `606*-608*`
* San Francisco: `941*`
  {% endtab %}

{% tab title="Canada (Postal Code)" %}
**Format**: A1A 1A1 (letter-digit-letter space digit-letter-digit)

**Examples**:

* Exact: `M5H 2N2`
* Wildcard: `M5*` (all M5x codes)
* First 3: `M5H*`

**Common patterns**:

* Toronto downtown: `M5*`
* Vancouver: `V6*`, `V5*`
* Montreal: `H2*`, `H3*`
* Ottawa: `K1*`, `K2*`

{% hint style="info" %}
Canadian postal codes can be entered with or without spaces.
{% endhint %}
{% endtab %}

{% tab title="United Kingdom" %}
**Format**: Variable (e.g., SW1A 1AA, M1 1AE)

**Examples**:

* Exact: `SW1A 1AA`
* Wildcard: `SW1*` (all SW1 codes)
* Area: `M1*` (Manchester city center)

**Common patterns**:

* Central London: `SW1*`, `WC1*`, `WC2*`, `EC1*`
* Manchester: `M1*`, `M2*`
* Birmingham: `B1*`, `B2*`
  {% endtab %}

{% tab title="Australia" %}
**Format**: 4 digits (e.g., 2000)

**Examples**:

* Exact: `2000`
* Wildcard: `20*` (all 20xx codes)
* Range: `2000:2099`

**Common patterns**:

* Sydney CBD: `2000-2009`
* Melbourne CBD: `3000-3009`
* Brisbane CBD: `4000-4009`
  {% endtab %}
  {% endtabs %}

## Advanced Patterns

### Exclude Specific Codes

**Free shipping everywhere in 941xx except 94188**

* Rule Group 1:
  * Condition: Postcode **matches any of** 941\*
  * Condition: Postcode **does not match** 94188

### Multiple Regions

**Free shipping in SF Bay Area**

**Configuration**:

* Condition: Postcode **matches any of**
  * 941\* (San Francisco)
  * 945\* (San Mateo)
  * 946\* (Palo Alto)
  * 947\* (Berkeley)
  * 948\* (Oakland)

### Tiered by Distance

**Different discounts by distance from warehouse**

**Discount 1** (Local - 5 miles):

* Postcode **matches any of** 94107, 94110, 94103
* Discount: Free

**Discount 2** (Regional - 20 miles):

* Postcode **matches any of** 941\*, 945\*
* Discount: $5 off

**Discount 3** (Extended - 50 miles):

* Postcode **matches any of** 94\*, 95\*
* Discount: $10 off

## Combining with Other Conditions

### Postcode + Value

**Free shipping for local orders over $30**

* Condition 1: Postcode **matches any of** 941\*
* Condition 2: Cart total **is at least** $30

### Postcode + Customer

**VIPs get free shipping everywhere, others only local**

* Rule Group 1 (VIP):
  * Condition: Customer tag **contains** "VIP"
* Rule Group 2 (Local):
  * Condition: Postcode **matches any of** 941\*, 942\*

### Postcode + Product

**Free local delivery on furniture**

* Condition 1: Postcode **matches any of** 941\*
* Condition 2: Collection **contains** "Furniture"

## Best Practices

{% hint style="info" %}
**Start with wildcards.** Use `941*` instead of listing every code from 94100:94199. It's easier to manage.
{% endhint %}

{% hint style="info" %}
**Test with real addresses.** Enter actual customer addresses in checkout to verify patterns match correctly.
{% endhint %}

{% hint style="info" %}
**Consider postal code formats.** Different countries have different formats. Make sure your patterns match the local format.
{% endhint %}

{% hint style="info" %}
**Use ranges for contiguous areas.** If postal codes are sequential in your region, ranges are cleaner than wildcards.
{% endhint %}

{% hint style="warning" %}
**Case sensitivity varies.** Some countries use letters in postal codes. The app handles case-insensitively, but be consistent.
{% endhint %}

## Pattern Matching Rules

| Pattern       | Matches       | Doesn't Match |
| ------------- | ------------- | ------------- |
| `94107`       | 94107 only    | 94108, 94106  |
| `941*`        | 94100:94199   | 94200, 95100  |
| `94100:94199` | 94100:94199   | 94200, 94099  |
| `M5*`         | M5A, M5H, M5J | M6A, K1A      |
| `SW1*`        | SW1A, SW1P    | SW2, W1       |

## Troubleshooting

<details>

<summary>Pattern not matching expected codes</summary>

* Verify the pattern syntax (use \* for wildcards)
* Check if spaces are required (e.g., Canadian codes)
* Test with exact code first, then expand to pattern
* Ensure country format matches your pattern

</details>

<details>

<summary>Discount applying to wrong areas</summary>

* Review your wildcard patterns (941\* matches 94100:94199)
* Check for overlapping patterns
* Verify you're using "matches" vs "does not match" correctly

</details>

<details>

<summary>International postal codes not working</summary>

* Different countries have different formats
* Check the format for that country
* Test with actual postal codes from that region
* Some countries don't use postal codes

</details>

## Related Conditions

* [**Province/State**](/advanced-free-shipping/conditions-location/province-state.md): Target entire states or provinces
* [**Shipping Country**](/advanced-free-shipping/conditions-location/shipping-country.md): Target entire countries
* [**Shopify Market**](/advanced-free-shipping/conditions-location/market.md): Regional market targeting
* [**Cart Total**](/advanced-free-shipping/conditions-cart-and-order/cart-total.md): Combine with value thresholds


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://responsive-media.gitbook.io/advanced-free-shipping/conditions-location/postcode-zip.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
