Tax By City Magento 2 Extension by DCKAP

- E-Commerce, Magento 2

Magento 2 Tax By City Extension

“In this world, nothing can be said to be certain, except death and taxes.” – Benjamin Franklin. Per this statement by one of the Founding Fathers of the United States, Taxes are inevitable. We pay tax for anything and everything, especially for retail purchases, be it brick-and-mortar or eCommerce stores. Things get complicated because every city in the US has different tax rates. Employing these tax rates in eCommerce checkout pages isn’t a piece of cake but quite complex and time-consuming.

Native Magento systems only support to manage the tax based on the Country, State, and Zip-code. It’s not possible to manage the tax based on the City. To overcome this issue, DCKAP developed the module ‘Tax by City‘, which is used to manage the tax rate based on the city.

Download/Buy DCKAP Tax By City Magento 2 Extension

Below is the list of Scenarios we considered while developing the Tax by City Module:

  • Same City Name may exist in a different Zip code, but Tax rate may vary.
  • Same Zip Code may exist for different City, but Tax rate may vary.
  • Same City Name will come under specific zip code ranges.

Once the customer orders a product, during checkout, Tax by City extension calculates the tax based on the Shipping Address of the Customer. The calculated tax amount is automatically added to the invoice so that the customers are well informed about the tax component.


  • Manage taxes based on City, State, Country and Zip code
  • Enable/Disable the tax by the city anytime from Magento backend
  • Ability to provide zip code in ranges. E.g., 56001 – 56005
  • Zip Code ranges can also be manageable from Backend Configuration.
  • Reduces the pain point of managing taxes for cities with different zip codes or zip code with different cities
  • Supports translations
  • Follows Magento standards to ensure High Quality

Module Configuration:

To enable the extension, go to STORE > Configuration and from left-side menu navigate to DCKAP > Tax By City.

Magento 2 Tax By City Extension

  • Select Enable to Yes for enabling the module.
  • Select Enable City for Zip Code Range to Yes for allowing Store Owners to provide zip code in range.

Add new Tax Rate

Magento 2 Tax By City Extension

Navigate to Stores > Taxes > Tax Zones and Rates and Click ‘Add New Tax Rate’ Button in the right corner. Provide all the necessary information that Magento has by default and in addition, fill out the City field as well. If you don’t want to specify the city field, you can give empty. It will take as ‘*’.

If Enable City for Zip Code Range is set to Yes in Backend Configuration, Zip/Post is Range field is available to provide range values.

Once the tax information is given, save the tax rate information. The Tax Identifier should be unique.

Tax Rate Configuration

Manage all the tax rate configurations based on City/Zipcode. The store can filter the tax rates based on City as well.

Magento 2 Tax By City Extension

Assign Tax Rate to Tax Rule

Navigate to Stores > Taxes > Tax Rules.

Magento 2 Tax By City Extension

After creating a tax rate, assign the tax rate into tax rule ID. If you want to create a new tax rule, click Add New Tax Rule button, or to edit the previous rule click the Rule1 column. Here we have edited the Rule1

Magento 2 Tax By City Extension

Select the necessary taxes rates that are to be assigned to tax rule. Upon selection, click Save Rule. Once saved, the selected tax rates are visible on the grid page.

Magento 2 Tax By City Extension

Sample Test

Now you can test the tax rate in checkout page at front-end.

Magento 2 Tax By City Extension

If the city doesn’t match with postcode, clicking on the Next button will throw an error.  If the city is correct, it will redirect to payment and customers can check the tax rates in the Order Summary section.

Magento 2 Tax By City Extension

Note:  City field is not case sensitive. City value is must, to get the exact city based tax rate in front-end. It will come whatever you configured based on the city at the back-end.

Sample Scenarios

Let us take the scenario in which two different cities, Baldwin Hills and Leimert Park. Both have the same zip code 90008, but different tax rates, 7% and 8%, respectively. Even though the above cities have the same zip code, “Tax by City” extension has the provision to provide different tax rates as required in the above scenario.

In a slightly different version of the above scenario, we can create a tax rate with city name field empty with 7.5 % tax rate, which in turn will be applied to all the remaining cities under the zip code 90008.

Let us assume that a particular city, Leimert Park, has a range of zip codes, say 90000 to 90009. “Tax by City” extension allows you to define the city and the range.

As a continuation of the above scenario, some other city within that range, say Baldwin Hills, has a zip code of 90008 but a different tax rate. In this scenario “Tax by City” provides the provision to enter the city name (Baldwin Hills), zip code (90008) but a different tax rate for the same.

Download/Buy DCKAP Tax By City Magento 2 Extension