Line Item Tax Basis

Some merchants need an alternative way to calculate tax for line items in an order, especially if their back-end systems can't handle order-level discounts. They can only handle product level discounts, and need to be able to prorate across an order. In Salesforce B2C Commerce, you can specify that product line items are taxed according to their prorated price. You can also perform unit-level rounding. In both cases, you do this using the B2C Commerce APIs (LineItem.updateTax()) and Business Manager configuration settings.

Line Item Tax Basis

The line item tax basis feature provides an alternative way to calculate tax for line items in an order. This tax calculation eliminates rounding errors and penny-off problems encountered by some merchants, and distributes order-level and BOGO discounts across line items so that each item has a reasonable item price for functions such as returns handling.

With this feature, product line items are taxed according to their prorated price, that is, the price after order-level and BOGO discounts have been prorated. The order calculation isn't changed in any way ¡- only the tax calculation is changed. This means that all existing line item attributes (for example, net price, gross price, and base price) retain their original values. Price adjustments for these items are included in order totals, but retain the tax value of 0.00.

The following table describes the tax calculations that are used when the line item tax basis setting is enabled and disabled:

Site taxation policy Tax products & shipping only based on adjusted price - setting enabled Tax products, shipping & discounts based on price (default) - setting disabled
Net tax = taxBasis * taxRate tax = netPrice * taxRate
Gross tax = taxBasis * (1 - (1 / (1 + taxRate))) tax = grossPrice * (1 - (1 / (1 + taxRate)))

The tax basis for line items appears within the Business Manager Order module, and the data is included in order export.

Note: When line item tax basis is disabled, the tax basis for a line item is equal to its price.

Configuration Setting

This feature is disabled by default. To use this feature, you must configure discount taxation in promotion site preferences.

Unit Level Rounding

If you prorate tax across an order, each line item has values for the single unit gross price (base price, or the price book price) and the line item totals for gross, net and tax. The single unit net price isn't calculated or stored. All rounding is done at the line level, which can cause rounding discrepancies. If your site experiences these discrepancies, you might need to use unit-level rounding.

When updating the tax with the dw.order.LineItem#updateTax() method, and using unit-level rounding, the tax is calculated for each unit, rounded, and then summed.

Note: The default implementation, using dw.ocapi.shop.basket.calculation, also considers this preference in the same way during calculation.

Many order management systems require the single unit net price to calculate refunds for returned products, which must be calculated based on the values that are provided in the order. One way to do this is to divide the net line total by the line item quantity. If the customer returns all three units from the order, the sum of all three returned items is a penny off from the calculated net total.

The following table shows the formulas used for the tax calculations:

  Gross total Tax total Net total
Item level Round (BasePrice * Quantity) Round(GrossTotal * (1-(1/(1+TaxRate))) Round(GrossTotal - TaxTotal)
Unit level Round (BasePrice * Quantity)

$TaxUnit = Round(BasePrice * (1-(1/(1+TaxRate)))

TaxTotal = TaxUnit * Quantity

Round(GrossTotal - TaxTotal)

Configuration Setting

This feature is disabled by default. You must configure it in order site preferences. To use this feature, you must also configure discount taxation in promotion site preferences.

Example

The following table shows an order with three units of product_A, where line-level rounding (the default) is used:

Item Base price Quantity Tax rate Gross total Tax total Net total
1 $18.99 3 0.21% $56.97 $9.89 $47.08
        Gross total order Tax total order Net total order
        $56.97 $9.89 $47.08

The line item net total is 47.08.

Item Base price Quantity Tax rate Gross total Tax total Net total
1 $18.99 1 0.21% $18.99 $3.30 $15.69
2 $18.99 1 0.21% $18.99 $3.30 $15.69
3 $18.99 1 0.21% $18.99 $3.30 $15.69
        Gross total order Tax total order Net total order
        $56.97 $9.90 $47.07

If the order is for three line items of quantity one, the line item net total is $47.07, a one penny discrepancy.

When item price rounding is set to Item-level, the tax total formula is now in two parts (as shown in the above formula table):

  1. TaxUnit = Round(BasePrice * (1-(1/(1+TaxRate)))
  2. TaxTotal = TaxUnit * Quantity

Following the above example, the calculation for an order with three line items, each with a quantity of one, stays the same; while an order with one item with a quantity of three is as follows:

Item Base price Quantity Tax rate Gross total Tax total Net total
1 $18.99 3 0.21% $56.97 $9.90 $47.07
        Gross total order Tax total order Net total order
        $56.97 $9.90 $47.07

With rounding on the unit level, the order totals are the same regardless of whether products are in one or multiple line items.

Related Links

Promotions for Developers

Promotion Discounts

Promotions and Taxation

Managing Site Taxes

Prorating Promotions

B2C Commerce API documentation
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. By continuing to use this site you are giving us your consent to do this.