The Shipping by City For Table Rate Shipping plugin is a free extension offered to add more settings in the Table Rate method by Bolder Elements. WooCommerce offers location settings based on Country, State/Province, and Postal Code in their shipping zones. However, in some parts of the world, there may not be a postal code system in use. This makes it difficult to change shipping costs based on the city of shipping. With this extension, an admin can limit a Table Rate method to a specific list of cities based on their names.
Requires Table Rate Shipping for WooCommerce 4.0+
Install and Activate the Table Rate Shipping plugin for WooCommerce followed by the Shipping by Cities plugin. With both plugins activated, a new section will be added to your Table Rate method titled Shipping by City. To find these settings, you will first need to create your shipping zones. It is important to note that customers can only qualify for one shipping zone, so make sure that your shipping zone locations do not overlap. If you are setting up shipping for various cities in Jamaica, you should only have one zone set to all of Jamaica.
For more information, see this article: Configuring the Shipping Zones
Once your zone(s) has been setup, you will be able to add as many Table Rate methods as needed. If some of your cities ship at the same prices, it is best to group these together into one shipping method to minimize how many methods are needed. City based settings are only at the method level. There are currently no settings in the table of rates to support cities, so you will need one Table Rate method for every group of cities in your shipping region.
This image details the shipping zone settings for a single country that has been split into 4 regions.
The Settings Page
There are four options within the Shipping By City box to allow for ideal customization and special case scenarios like the ‘Everywhere Else’ method in the example above.
Firstly, if we are going to use this feature we must specify so. Checking this box enables the Cities section so that the method will only appear for customers shipping to the cities provided in the list below.
- Region is…
This select box toggles whether the method works for the cities listed below, or for cities not in the list below. By default it is set to include all cities given, but it can be changed to exclude the cities listed in the box below.
- Allowed Cities
This is the texbox where the cities to be included (or excluded) are listed. As with similar settings in WooCommerce, it requires one city per line in the box in order for the plugin to separate and recognize which city is which. Comparisons are NOT case sensitive, but spelling will need to match exactly.
- Disable Other Methods
This is a special option to communicate with other Table Rate methods. When the box is marked, all Table Rate methods that follow this one will be ignored if the customer’s city matches one of the cities listed in this box (or does not match if you are ‘Excluding’ the list). This will not hide other methods, but can prevent other Table Rate methods from returning an option. For example, in the first screenshot you see 3 regions defined with a 4th titled Everywhere Else. If this feature is enabled for the first three Table Rate methods, then we can leave this box empty in the Everywhere Else method and it will only appear for customers whose City name did not match any in the top three methods. This allows you to reduce the amount of setup and ensure that everyone is included in the shipping calculation.
If you believe spelling of these cities may be an issue, or you simply want to improve the customer accuracy or experience, it is possible to change the City field in the checkout form to a select box. This will instead offer users a pre-defined selection of cities rather than have them enter it for themselves. We recommend the WC City Select plugin to help in creating the list of cities and making this change.
There is also a newer version written by a different developer that may be useful, but we have not personally tested this one yet.