CalculateSalesTax in DefaultTaxCalculator not being called when I change the OrderAddress

Vote:
 

Hi,

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:

  • We add a new OrderAdress with the new state code (We set it in the state, regionname and regioncode fields) and the country code
  • We remove the old OrderAddress
  • We update each lineitems.ShippingAddressId
  • We run CartHelper.RunWorkflow(OrderGroupWorkflowManager.CartPrepareWorkflowName);

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.

#195883
Aug 09, 2018 21:29
Vote:
 

This is a known issue and we are working on it. 

#195884
Aug 09, 2018 22:13
Vote:
 

Is it fixed? If not, are there any workarounds?

#196567
Sep 04, 2018 15:06
Vote:
 

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 

#196568
Sep 04, 2018 15:08
Vote:
 

Commerce 12.8.0 is now available: https://world.episerver.com/releases/episerver---update-230/

#196575
Sep 04, 2018 18:17
Vote:
 

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.

#196577
Sep 04, 2018 18:51
Vote:
 

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

#196578
Sep 04, 2018 19:23
Vote:
 

I filed COM-7854, we will be working on it soon 

#196587
Sep 05, 2018 8:45
Vote:
 

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.

#196631
Sep 05, 2018 21:28
Vote:
 

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 ;)  

#196645
Sep 06, 2018 7:50
Vote:
 

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.

#196667
Sep 06, 2018 14:59
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.