Shipping Rule based on City or State

Official Documentation does mention a little bit about shipping rules. But here they are applied on the basis of the Country.

A significant number of people would need to apply shipping rules based on the place of shipping rather than just the quantity or cost of order. Right now the resolution available is “Country”. Can it be done for State or City or Postal code level? My current understanding is that I might have to edit the apps/erpnext/erpnext/shopping_cart/ file.
Is there a better strategy to achieve this end?

Did you try it?
I think it will work based on the state and others, not only based on the country.


Yes I tried. It only provides resolution up to Country Level. Unless I label Countries as Cities or Postal Code.

Yes I noticed this. I was confused with Tax rule which can be used (as I know) on County, City and Country.
Anyway, yes you need to do customization for Shipping Rule doctype and you need to change in the code (and most probably it will be a method, but I do not know which method exactly) that is responsible for fetching the Shipping Rule. Of course this method is used by too many documents (Sales Order, Sales Invoice, Purchase Order, Purchase Invoice, … etc).


The Tax Rule territory tree system is very good. But Shipping rule system should have matched the tax rule tree. A whole Country is too big a territory for most situations.

any update related to this case in the new version of erpnext