Setting Tax Values


Commerce 11.8.2

We use serialised carts and currently are unable to set the tax value on the cart.

We can get the tax value using the taxcalculator, but it looks like setting the tax value isn't exposed on the new seralised carts/orderforms/ordergroups.

Documentation here: shows how to get the tax but not set the tax.

Any assistance or direction to documentation would be great.

Edited, Jul 20, 2018 17:33

You would need to implement ITaxCalculator to return the tax value you would want to, and they will be set for you.

Also, in Commerce 11 or before the tax is calculated every time IOrderGroup is loaded. I would suggest to upgrade go later version (Commerce 12) for better performance.

Jul 20, 2018 17:54

Thanks Quan. 

Would this allow us to dynamically set the tax total ourselves...lets say we've already precalculated the tax at £100 and we just want to set this tax on the cart how is this possible?

Jul 20, 2018 18:14

In Commerce 12 you have PricesIncludeTax property in IMarket. That indicates your prices already have precalculated taxes (like in EU). i guess that is what you want

Jul 20, 2018 18:25

Hi Quan, 

What I want to do is to be able to set TaxTotal on the serialised cart and subsequent orderforms/ordergroup/purchaseorder. This property isn't exposed in the current interfaces and I cannot see how to set it anywhere else.

Unfortunatly while commerce 12 is on the road map to upgrade it currently isn't possible and so we have to develop this on 11.8.2

Jul 20, 2018 18:54

I don't know a guaranteed workaround, but you should be able to cast the instance to the concrete implementation and set it. of course that's an ugly way to do so.

What prevents you from upgrading to Commerce 12?

Jul 20, 2018 19:58

Hi Quan,

Time frames prevent the upgrade to Commerce 12, as I said it is on the roadmap but for later down the line.

I have tried to use the concrete implementations:

((PurchaseOrder)purchaseOrder).TaxTotal = 100.0M; // Not hard coded just as an example

In doing the above I can see TaxTotal on the PurchaseOrder, but, as soon as we save it the TaxTotal is zero'd

Jul 23, 2018 12:52

Did you try this? 

Jul 23, 2018 13:00
* 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.