There are a couple common setups for city based shipping in WooCommerce. One being having different cost per city, and another is to limit shipping completely to a certain set of cities.
Create a New Shipping Rate
The first step to creating any city based setup is to create a new shipping rate. Go to the WooCommerce
> Settings
> Shipping
> Advanced Shipping
section and create a new shipping rate.
Setup City Based Shipping Conditions
The next step is to determine for which city you’ll create a shipping rate for. Keep in mind that Advanced Shipping rates can have a set shipping cost per shipping rate, so for each city you want to have a different cost for you can create a different shipping rate.
From the condition list select the ‘City’ condition. In the value field that will be loaded in you can enter the city you want this shipping rate to appear for. A couple things to denote while entering the city value;
- Cities are matched case insensitive
- Spaces matter
- Customer city must be an exact match
- Condition works with equal to and not equal to operators
- Comma separated list of cities is possible
When you have multiple cities with the same shipping cost, using a comma separated list of cities is the best way to go.
Common Pitfalls
Multiple ‘City’ conditions
Do not use multiple ‘City – equal to’ conditions in one condition group. The system will only match when all conditions in one condition group matches, and each individual ‘City – equal to’ condition will require the customer to have the given city.
Not using state/country condition
Do you offer (inter)national shipping? Be aware that there may be cities out there with the same name possibly in the same country or otherwise in other countries. You can use the ‘Country’ or ‘State’ conditions to specify more precisely which city you want to target.