Skip to main content

How to Create Location-Based Shipping Methods in WooCommerce (City, State, Zip, Country)

Learn how to create a location-based shipping method in WooCommerce using the Discount Rules and Dynamic Pricing plugin. This complete guide covers setting up shipping costs based on customer location, including country, state, city, and postcode conditions. Offer flexible location-based shipping rates that match your store's needs.

📋 Table of Contents


🚀 Why Create Location-Based Shipping Methods?

Creating location-based shipping methods allows you to offer different shipping rates and options based on where your customers are located. Whether you want to charge different rates for specific states, offer free shipping to certain cities, or create international shipping rules, location-based shipping gives you the flexibility to match your logistics needs.

Common Location-Based Shipping Scenarios

ScenarioDescriptionUse Case
State-BasedDifferent rates for customers in specific states or provincesCharge higher rates for distant states
Country-BasedDifferent rates for customers in specific countriesInternational shipping with different costs
City-BasedDifferent rates for customers in specific citiesOffer free delivery to local cities
Postcode-BasedDifferent rates for specific zip/postal codesLocal delivery zones with specific costs
Zone-BasedDifferent rates for entire shipping zonesRegional shipping with consistent rates

Key Statistic: 31.6% of the top million online stores are powered by WooCommerce, with location-based shipping being a top requested feature.


Location-Based Condition Types

The Discount Rules and Dynamic Pricing plugin supports the following location-based conditions for shipping methods:

ConditionDescriptionExample
Shipping CountryApply method when customer's country matchesUnited States, Canada, United Kingdom
Shipping StateApply method when customer's state/province matchesNew York, California, Texas
Shipping CityApply method when customer's city matchesNew York, Los Angeles, Chicago
Shipping PostcodeApply method when customer's postcode matches90210, 10001, 100* (wildcard)
Shipping ZoneApply method when customer's shipping zone matchesDomestic US, Europe, Local

Note: Shipping zones are matched in a hierarchy, from the top of the list to the bottom. WooCommerce chooses the first shipping zone that a customer matches and shows those options on the cart and checkout pages.


Step-by-Step: Create a State-Based Shipping Method

Best for: Charging different rates for customers in specific states or provinces. Perfect for stores with varying shipping costs by location.

Scenario: Create a shipping method called "New York Shipping" with a cost of $30 for customers in New York and New Mexico.

Step 1: Access Shipping Methods and Choose a Template

  1. In your WordPress admin, go to the Woo Pricing & Discounts menu
  2. Open the Shipping Methods tab
  3. Click on the Add from Template button

Add from Template button - Shipping Methods tab

  1. Under Standard Shipping, find and select "State Specific Shipping Rates"
  2. Click "Add Method"

State Specific Shipping Rates template

Step 2: Configure the Shipping Method

State-Based Shipping configuration

  1. Name: "New York" (customizable) — This is the title customers see at checkout
  2. Status: Ensure Enable is checked
  3. Apply Mode: Choose how this rule interacts with other shipping methods
    • Apply this rule and disregard other rules — Only this shipping method will be shown
    • Apply with other applicable rules — This method will appear alongside other options
    • Apply if other rules are not applicable — This method will appear if other shipping methods are not applicable
  4. Tax Status: Choose Taxable or None
  5. Cost: Enter the base shipping cost (e.g., 30)
  6. Cost Per Quantity: (Optional) Set a cost per item
  7. Cost Per Weight: (Optional) Set a cost per weight unit
  8. Fee: (Optional) Add an additional fee

Step 3: Schedule the Shipping Rule (Optional)

By default, the campaign is unscheduled and runs immediately:

Unscheduled shipping rule

For scheduled promotions, under the "Date Time" section to configure:

  • Date Range — Run a promotion over a period (e.g., for a holiday sale)
  • Date Time Range — Precise start and end date/time for limited-time offers
  • Specific Date — Single date activation (e.g., Black Friday)
  • Days — Recurring weekly promotions (e.g., Free Shipping Fridays)
  • Time — Daily time ranges (e.g., flash free shipping)

Schedule for a date period

Use "+ And New Rule" to combine conditions or "+ OR New Group" for alternative schedules.

tip

For a deep dive into timezone setup, recurring schedules, and multi-tier scheduling logic, read our comprehensive Scheduling & Date-Time Guide.

Step 4: Set State Conditions

Under the Conditions section:

  1. Add a "Shipping state" condition
  2. Select the states where this shipping method should apply
  3. You can select multiple states

State-Based Shipping conditions

Example: In our tutorial, we'll select United States (US) - New Mexico and United States (US) - New York.

tip

For full details on all 14 condition groups, AND/OR logic, and available comparison operators, check out our Complete Rule Conditions Guide.

Step 5: Save and Test

Click Save and test by entering a shipping address in one of the selected states.

State-Based Shipping full configuration


Step-by-Step: Create a Country-Based Shipping Method

Best for: Charging different rates for customers in specific countries. Perfect for international shipping.

Scenario: Create a shipping method for customers in the United States and United Kingdom.

Step 1: Access Shipping Methods and Choose a Template

  1. Go to Woo Pricing & Discounts > Shipping Methods
  2. Click Add from Template
  3. Select "State Specific Shipping Rates" (or use "Custom Shipping Method")
  4. Click "Add Method"

International Shipping Rates template

Step 2: Configure the Shipping Method

Follow the same configuration steps as the state-based method, setting your desired shipping cost.

Step 3: Set Country Conditions

Under the Conditions section:

  1. Add a "Shipping country" condition
  2. Select the countries where this shipping method should apply
  3. You can select multiple countries

Country-Based Shipping conditions

Example: In our tutorial, we'll select United Kingdom (UK) and United States (US).


tip

For full details on all 14 condition groups, AND/OR logic, and available comparison operators, check out our Complete Rule Conditions Guide.

Step-by-Step: Create a City-Based Shipping Method

Best for: Offering free shipping or special rates to specific cities. Perfect for local delivery zones.

Scenario: Create a shipping method for customers in New York, Los Angeles, and Chicago.

Step 1: Access Shipping Methods and Choose a Template

  1. Go to Woo Pricing & Discounts > Shipping Methods
  2. Click Add from Template
  3. Select "City Specific Shipping Rates"

City Specific Shipping Rates template

  1. Click "Add Method"

Step 2: Configure the Shipping Method

Follow the same configuration steps as the state-based method.

Step 3: Set City Conditions

Under the Conditions section:

  1. Add a "Shipping city" condition
  2. Select "Equal to comma separated list"
  3. Enter the city names separated by commas

City-Based Shipping conditions

Example: In our tutorial, we'll enter New York, Los Angeles, Chicago.

💡 Tip: Cities are matched exactly as entered. Make sure the city names match the format customers use at checkout.


tip

For full details on all 14 condition groups, AND/OR logic, and available comparison operators, check out our Complete Rule Conditions Guide.

Step-by-Step: Create a Postcode-Based Shipping Method

Best for: Offering different rates for specific postal codes or zip codes.

Scenario: Create a shipping method for customers with specific postcodes.

Step 1: Access Shipping Methods and Choose a Template

  1. Go to Woo Pricing & Discounts > Shipping Methods
  2. Click Add from Template
  3. Select "Local Delivery via Zip Codes"

Local Delivery via Zip Codes template

  1. Click "Add Method"

Step 2: Configure the Shipping Method

Follow the same configuration steps as the state-based method.

Step 3: Set Postcode Conditions

Under the Conditions section:

  1. Add a "Shipping postcode" condition
  2. Select "Match"
  3. Enter the postcode pattern

Postcode-Based Shipping conditions

Supported Postcode Formats:

  • Specific postcode: 96969
  • Wildcard: 969** (matches all postcodes starting with 969)
  • Range: [96960 - 96970]
  • UK Postcode: SIQQ 1ZZ
  • Multiple: 96969, 969**, [96960 - 96970], SIQQ 1ZZ

tip

For full details on all 14 condition groups, AND/OR logic, and available comparison operators, check out our Complete Rule Conditions Guide.

Step-by-Step: Create a Shipping Zone-Based Method

Best for: Applying shipping methods to entire shipping zones.

Scenario: Create a shipping method for customers in a specific shipping zone.

Step 1: Access Shipping Methods and Choose a Template

  1. Go to Woo Pricing & Discounts > Shipping Methods
  2. Click Add from Template
  3. Select "Shipping Zone Specific Rates"

Shipping Zone Specific Rates template

  1. Click "Add Method"

Step 2: Configure the Shipping Method

Follow the same configuration steps as the state-based method.

Step 3: Set Shipping Zone Conditions

Under the Conditions section:

  1. Add a "Shipping zone" condition
  2. Select the shipping zones where this method should apply

Shipping Zone-Based conditions

💡 Note: Shipping zones must be created in WooCommerce > Settings > Shipping > Shipping Zones before they appear in the conditions list.


tip

For full details on all 14 condition groups, AND/OR logic, and available comparison operators, check out our Complete Rule Conditions Guide.

Result Example

State-Based Shipping Method Result

Cart items:

  • Shirt: $20.00
  • Shirt - Green: $25.00 × 2

Subtotal: $70.00

Customer Address: New York

Result: The "New York" shipping method appears with a cost of $30.00.

Location-based shipping applied in cart

Cart display shows:

  • Subtotal: $70.00
  • Shipping method: New York — $30.00
  • Estimated total: $100.00

Note: The result example above is for the state-based shipping method. Country-based, city-based, postcode-based, and zone-based shipping methods will display similar results — the shipping method name and cost will appear based on the conditions you've configured for each location type.


🚀 Troubleshooting: Shipping Method Not Showing?

If your location-based shipping method doesn't appear at checkout, follow these steps:

Step 1: Check Your Conditions

  1. Verify that the customer's address matches the condition (country, state, city, postcode, or zone)
  2. Test with an address that clearly meets the condition
  3. Try removing conditions temporarily to test

Step 2: Check Shipping Zone Hierarchy

  1. Go to WooCommerce > Settings > Shipping > Shipping Zones
  2. Ensure zones are ordered correctly — from smallest geographical area to largest
  3. For city-based shipping, drag the zone to the top of the list

Step 3: Check Apply Mode

  1. If Apply Mode is set to "Apply this rule and disregard other rules", ensure no conflicting rules exist
  2. Try switching to "Apply with other applicable rules"

Step 4: Check City Name Format (For City-Based Shipping)

  1. Ensure the city names in the condition match exactly how customers enter them at checkout
  2. Check your checkout page to see the exact city name format

Step 5: Check for Plugin Conflicts

  1. Conflicting Shipping or Zone Plugins: Third-party shipping plugins (like Table Rate, custom zone calculators, or address validator plugins) can alter location packages before WooCommerce evaluates shipping rules. Temporarily deactivate competing shipping and discount plugins to test.
  2. Admin Screen Conflicts: If you encounter blank admin screens or settings failing to save, check the browser console (F12) for JavaScript conflicts caused by plugins that inject scripts globally in the admin (such as SkyVerge or analytics tools).
  3. Caching & Caching Plugins: Ensure cart and checkout pages are excluded from page caching plugins. Clear your site and object cache before re-testing.
  4. Learn More: For complete conflict troubleshooting instructions, see our Complete Troubleshooting Guide.

🎉 Success!

You've learned how to create location-based shipping methods in WooCommerce using the Discount Rules and Dynamic Pricing plugin. This powerful feature allows you to:

  • Create shipping methods for specific locations — countries, states, cities, postcodes, and shipping zones
  • Set different shipping rates based on customer location
  • Schedule promotions for specific dates or recurring campaigns
  • Offer location-based free shipping for local customers

📚 Next Steps

Now that you've mastered location-based shipping methods, explore other powerful ways to use the Shipping Methods features:


🔍 SEO Keywords

Primary Keywords: location-based shipping WooCommerce, shipping by state, shipping by city, shipping by postcode, WooCommerce shipping conditions, conditional shipping

Secondary Keywords: WooCommerce shipping zones, state-specific shipping, city-specific shipping, postcode shipping, country-based shipping, shipping method conditions, WooCommerce shipping rates, Discount Rules and Dynamic Pricing plugin