Sitecore Experience Commerce – Vertex tax calculation
Before I started with this functionality I thought it would be a very difficult one to deal with. Lucky me figured out that wasn’t the case.
The price calculation of the cart in Sitecore Experience Commerce is handled by actually just two pipelines, ICalculateCartPipeline and ICalculateCartLinePipeline.
In these pipelines you send all the cart information, including the merchant/warehouse and customer address, to Vertex which will return the tax calculation breakdown. All you have to do with that information is add it to the cart as a CartAdjustment with the name “TaxFee”.
Make sure you disable the OOTB tax calculation by either removing it from the same pipelines or setting the tax percentage to 0% in the configuration.
Next to that Vertex requires you to create the order in Vertex as well after payment. To do this we extend the ReleasedOrdersMinion with an extra block to register the order at Vertex.
Find the full example at GitHub: