---
schema_version: "1"
id: 5cc7eec943609e7301781db5b0ce7b1c0fdbf519a92b74dbec4fcbd692476752
title: Unit Level Rounding
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/cc/264-0-0/b2c_unit_level_rounding.md
canonical_url: https://help.salesforce.com/s/articleView?id=cc.b2c_unit_level_rounding.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 375500c84cc50deaeba3e5f608ac176e2aa10e53087db199b693be55351f3569
description: If you prorate tax across an order, each line item has values for the single unit base 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 B2C Commerce site experiences these discrepancies, use unit-level rounding.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# Unit Level Rounding

If you prorate tax across an order, each line item has values for the single unit base 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 B2C Commerce site experiences these discrepancies, 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](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-cc-b2c_merchandiser_administrator-264-0-0-production-enus/ea76f372-6cfa-42a6-8e7c-05c6df7abed8/images/icon_note.png)

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 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.

This feature is disabled by default. Configure it in [order site preferences](https://help.salesforce.com/s/articleView?id=cc.b2c_order_preferences.htm&release=264.0.0&type=5 "Select how orders are processed with Salesforce B2C Commerce.") and configure discount taxation in [promotion site preferences](https://help.salesforce.com/s/articleView?id=cc.b2c_configuring_promotion_preferences.htm&release=264.0.0&type=5 "Configure many of the promotion settings as site preferences, giving you much flexibility in how your promotions are handled. These settings include Buy X/Get Y promotion behavior, discount precision, and how the tax basis is calculated for line items with discounts.").

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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
      <colgroup>
        <col style="width:24.738675958188153%">
        <col style="width:24.738675958188153%">
        <col style="width:24.912891986062718%">
        <col style="width:25.609756097560975%">
      </colgroup>
      <thead class="slds-text-title_caps ">
        <tr class="">
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d242983e76">&nbsp;</th>
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d242983e78">Gross total</th>
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d242983e81">Tax total</th>
          <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d242983e84">Net total</th>
        </tr>
      </thead>
      <tbody>
        <tr class="">
          <td data-label="" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e76 ">Item level</td>

          <td data-label="Gross total" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e78 ">Round (BasePrice * Quantity)</td>

          <td data-label="Tax total" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e81 ">Round(GrossTotal * (1-(1/(1+TaxRate)))</td>

          <td data-label="Net total" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e84 ">Round(GrossTotal - TaxTotal)</td>

        </tr>
        <tr class="">
          <td data-label="" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e76 ">Unit level</td>

          <td data-label="Gross total" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e78 ">Round (BasePrice * Quantity)</td>

          <td data-label="Tax total" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e81 ">
            <p>$TaxUnit = Round(BasePrice * (1-(1/(1+TaxRate)))</p>
            <p style="margin-bottom:0;">TaxTotal = TaxUnit * Quantity</p>
          </td>

          <td data-label="Net total" class="slds-cell-wrap" style="vertical-align:top;" headers="d242983e84 ">Round(GrossTotal - TaxTotal)</td>

        </tr>
      </tbody>
    </table>

Configuration Setting

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.