Taxes are calculated in three different areas in the checkout process:
- On the ShoppingCart page if a customer chooses to have the system estimate shipping and taxes based on an arbitrary address and whatever is in the cart at that point.
- On any page that shows the ShoppingCart or Order Summary
- Finally, when the Order is created during final processing.
Key classes and files
- VM_global_library.vm - Contains the Velocity macro #displayCartSummary which writes the shipping and taxes cost to the viewCart.vm and deliveryOptions.vm screens.
- CheckoutServiceImpl - Contains tax calculation service methods which are called by the ShoppingCartAjaxController.
- ShoppingCartImpl - Contains tax calculation methods.
- OrderTaxValue - Represents tax information for a completed order.
How it works
When taxes are required by the checkout process, whether by the UI or by the Order creation process, the CheckoutService tax calculation methods are called.
These methods will set the shopping cart's TaxJurisdiction based on the shipping address (if any of the shopping cart items can be shipped) or the billing address (if the cart items are digital goods that do not require shipping). The CheckoutService will then delegate to the shopping cart, asking it to calculate the tax and before-tax prices.
For more information on Tax Jurisdictions and Tax Categories, see the Tax Categories section in the Commerce Manager User Guide.