-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provinces #76
Comments
In spain usually shipping to the Islands (both Canary and Balearic), has a surplus on shipping We also have province, which are also part of Comunidades Autonomas, I'm not sure how to handle this though, maybe we could have flexible defaults, and country-specific plugins from community |
@agustif For now it would also be possible to set up a ShippingCalculator which inspects the postalCode of the shipping address (if this can be relied upon) to add a surplus. This method works in the UK case because the highlands & islands have a well-defined postal code range. |
This will be absolutely vital for US-based stores, as sales tax is significantly complex. In general, there up to three levels of sales tax in the US:
Because there is no sales tax collection at the federal (country) level, businesses must only collect and remit taxes in the states where they have an "economic nexus" which, in a non-exhaustive sense, typically means one of:
I see two viable solutions here:
|
I think it worth to implement some generic mechanism, that will support deep level of locations, for example Zone -> Country -> Province/Area -> City -> Street -> House. This can be useful for taxes and for shipping calculations, especially where e-commerce is local, and shipping price depends on more precise location. |
@ashitikov for such fine-grained calculations as based on house or even street, do you not think it would be better to just use a custom function rather than create entities for these? I can imagine it being somewhat workable down to the city level, but deeper than that and you'll need a massive postal address database embedded in your data model. |
@michaelbromley There is no problem to use custom functions and entities, but having built-in native mechanism is great. Vendure allows developers to extend it deeply, introducing new entities, fields and do some injections in config - that is great, and I believe vendure can do more ;). There are a lot of cases when developer needs a flexible system to calculate tax and delivery price more precisely. Province is just the one of such cases. I have an idea, its not final, but I'll share it: From the developer perspective: you have 3 different classes and one base class. If you want to extend built-in places, register 4-th new class with ChildEntity() decorator and add it to plugin's entities. Also you may want to introduce custom graphql resolvers and types for an entity. From vendure's core perspective: tax and delivery calculation systems have to use 'Place' entity and pass it when required to calculators/handlers and etc... Instead of Countries, Zones, Provinces, we are working with Places. From vendure's admin-ui perspective: zones and countries may be dropped to use places instead. A list of places may be filtered by types. There are some complications with country-zone relations, but I believe anyway this is workable solution. Extended entities from places would also be visible and managed in the list. This way, e-commerce stores may develop plugins for advanced tax calculation, as well as for advanced delivery. Note: |
Relates to #76 BREAKING CHANGE: A new `Region` entity has been introduced, which is a base class for `Country` and the new `Province` entity. The `Zone.members` property is now an array of `Region` rather than `Country`, since Zones may now be composed of both countries and provinces. If you have defined any custom fields on `Country`, you'll need to change it to `Region` in your custom fields config.
The data model for Provinces support is now in place - it is similar to the suggestion by @ashitikov, but keeps the What's still missing is an Admin UI part to manage provinces - this will be included in the general ongoing Admin UI refresh work. |
It's probably too late for me to affect any architecture, but I might at least offer some insight, as I've now created popular solutions in this area in both Go and PHP, both taking after Google's libaddressinput which has been the golden standard in this area. Lessons I've learned over the years:
When it comes to zones, being able to define a zone spanning different regions is a good first step, but there are many use cases where dropping down to the postal code level (included/excluded by range or regexp) is needed. Happy to chat about this and other topics if you feel I can be of service. |
In Italy shipping costs depend also on zip codes: usually you have a fixed price for weight range (for example 1-3 Kg), with the exception of smaller Islands, Venice lagoon, Livigno (tax-free) and Campione d'Italia (which actually is in Swiss). These exceptions have a much higher cost. |
@matteofrana Hi! Yes we have something similar in the UK with the Scottish Highlands and also the islands of Jersey & Guernsey. This case can be handled by specific logic in a ShippingCalculator. |
A Province is a subdivision of a Country. In the UK, it would be a county such as Greater Manchester, whereas in the USA it would be a state such as Connecticut.
Province data is useful for certain tax and shipping calculations. Currently we only support tax & shipping calculations based on country, but for certain use-cases this is not granular enough.
Use cases
State-based taxes
In the USA, sales taxes differ state-to-state, in a rather complex way as outlined by this article: https://www.taxjar.com/guides/intro-to-sales-tax/#steps-to-sales-tax-compliance.
Region-based shipping
In the UK, small parcels can be sent by Royal Mail for a fixed price. However, certain counties are designated "highlands & islands", including the Scottish Highlands, Jersey, Guernsey etc. Shipping to these locations is more expensive owing to the difficulty of access or remoteness. Therefore province-based shipping rules would apply within a single country.
The text was updated successfully, but these errors were encountered: