Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Tax calculation

Tax calculation

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.

Much of the tax calculation code is called from Javascript methods.

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.
  • ShoppingCartAjaxControllerImpl - Methods are called by the UI Javascript code. These methods in turn call service methods to perform tax calculations.
  • 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.