We're completing our migration to Commerce 12.5 so we now use our overriden version of DefaultTaxCalculator to calculate our taxes(CalculateSalesTax and CalculateShippingTax).
My problem is that we have a cart summary page where we let the client change the state so they can see the taxes they're gonna pay and to do so, we create an temporary address with that state and that gave us our taxes when the CartPrepare workflow was completed.
But now it doesn't and when I dug in the code to see what was going on, I've founded out that the CalculateSalesTax was not called when the CartPrepare was called but the CalculateShippingTax was.
Here's what we do we the user change the state in our cart page:
Why CalculateSalesTax is not called when I change my OrderAddress and is there a way to make it work?
When I change the quantity, both CalculateSalesTax and CalculateShippingTax get called like I anticipated.
This is a known issue and we are working on it.
Is it fixed? If not, are there any workarounds?
Yes, it is now fixed in Commerce 12.8.0
The obvious workaround is to not change your OrderAddress, but to create a new one and assigne it to IShipment.ShippingAddress
Commerce 12.8.0 is now available: https://world.episerver.com/releases/episerver---update-230/
I've updated Commerce to 12.8.0 and I still have the same problem.
When I update my OrderAddress and call the CartPrepare workflow, CalculateSalesTax is not called, only CalculateShippingTax is called.
Hmm, it seems that I was mistaken. The bug you are seeing is something else, not the bug we were working on. I will check and get back to you
I filed COM-7854, we will be working on it soon
Thanks for the feedback.
Am I supposed to see the detail of this bug in the bug list (https://world.episerver.com/support/Bug-list/)?
I don't see it when I search for it.
Also is the workaround supposed to work (even if the bug is not the same)?
I've tried to add a new address in CartHelper.Cart.OrderAddresses and remove the old one. I also updated the CartHelper.LineItems to set the new shippingAddressId but the CalculateSalesTax is still not called.
The bug is not yet made public.
Hmm, now I look more into it, it looks like the only working workaround is to change the lineitem quantity and then set it back. That would trigger the clearing of "cached calculation value".
And - I know you have reasons, but - why are you still using CartHelper, you should have been using new abstraction APIs already ;)
I know about CartHelper, it's in our pipeline but we would need to change a lot of code to make it happen and we know we'll have to change a good part of it in the next year so we want to wait then to avoid changing it 2 times.