You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requirement
We have a requirement to implement an external tax calculation process, but only for customers based in the United States.
Each product and shipping method has its own tax code, and tax calculation can involve adding up the sub total cost of multiple separate tax rates between US states, depending on where in the US the company ships the product.
I'd love to be able to use calculation events in this order:
calculate order line price sub total (already exists)
calculate shipping cost sub total (already exists)
calculate tax on all of the above using an override that implements my new external tax calculation process (new feature?)
head to checkout with my final cost, and separate tax value specified.
However, I can only seem to:
calculate cost per product with an option to override tax calculation on the product
calculate order line sub total with an option to override tax calculation on the order line
calculate a shipping cost, with an option to override tax calculation on the shipping cost
This would require multiple requests to the external tax calculator.
The OrderCalculator class doesn't permit overriding, so I don't seem to be able to do anything with that, and amending the sub total in the Order Calculation State object within the shipping override isn't doing anything, as presumably I'm doing that too late in the pipeline.
Please let me know if I can do anything to help explain!
Cheers,
Karl
The text was updated successfully, but these errors were encountered:
karlitros
changed the title
OrderCalculator modification after shipping calculation
Calculate overall tax cost after shipping calculator overrides
Feb 27, 2024
Yea, the current implementation is very European centric, assuming the tax rates are known before hand, hence why it currently does most calculations up front.
The way I have seen others in the US get around this for the time being is to effectively set the entire order to 0% tax rate, but then implement a price adjuster (see https://docs.umbraco.com/umbraco-commerce/key-concepts/price-amount-adjustments) for the order total price which then goes and does it's own calculation but returns a price with a 0 value, but a positive tax value.
If you are using some external service to calculate taxes, you'll probably want to implement a cache to ensure it doesn't get hit constantly as Umbraco Commerce does recalculate the order a lot. What I've advised in the past is to take a hash of the order items product references + quantities and used that as a cache key so it only recalculates if the order items change.
I hope this helps
Matt
PS it is something we know we need to address to allow more robust tax calculations, but hopefully this gives you a workaround in the meantime.
Requirement
We have a requirement to implement an external tax calculation process, but only for customers based in the United States.
Each product and shipping method has its own tax code, and tax calculation can involve adding up the sub total cost of multiple separate tax rates between US states, depending on where in the US the company ships the product.
I'd love to be able to use calculation events in this order:
However, I can only seem to:
This would require multiple requests to the external tax calculator.
The OrderCalculator class doesn't permit overriding, so I don't seem to be able to do anything with that, and amending the sub total in the Order Calculation State object within the shipping override isn't doing anything, as presumably I'm doing that too late in the pipeline.
Please let me know if I can do anything to help explain!
Cheers,
Karl
The text was updated successfully, but these errors were encountered: