HubSpot calculates each Line Item Net Amount by subtracting the Total Discount from the Total Line Item Amount. If this causes rounding errors for you, here is how it works and what you can do to correct it.
HubSpot users sometimes ask how discount percentage is calculated and applied to a line item. "Is the discount applied to the item price and then multiplied by quantity? Or applied to the total line item price?" When the quantity is greater than 1, this answer may differ due to rounding errors.
The short answer is that HubSpot applies the percentage discount to the total line item price, not the individual product price.
For example, a line item of 10 products at $234.56 each, less a 20% discount.
If HubSpot applied the discount to the line item price:
- Item price $234.56 x 20% discount = 187.648, rounded to $187.65
- 10 items x $187.65 = $1876.50
What HubSpot does calculate:
- Total Line Item price = $234.56 x 10 = $2,345.60
- Total Line Item Discount = $2345.60 x 20% = $469.12
- Net Line Item Price = $2,345.60 - $469.12 = $1876.48
The difference is $0.02c
Often this small difference is not a problem, however if your customer contract states a discounted price per item, the actual price the customer pays may differ slightly when ordered in quantity.
Solutions to Line Item Discount% rounding errors.
If this is a problem for your organisation, here are couple of solutions:
- Convert discount % to a fixed amount per line item. This can be problematic because the sales rep must calculate the total discount and enter it as a fixed amount, then adjust it if the quantity varies.
- A better solution is to use DoPricer CPQ to apply a custom price list for this customer, with distinct per-item prices stated per product SKU. A custom price list ensures that regardless of quantity, DoPricer will always apply the customer’s contracted per item price.
Technical Details:
For the technical community, here are HubSpot’s three line item calculation properties which apply discount % to the line item total.
There are three calculation properties involved:
- hs_pre_discount_amount
- hs_total_discount
- amount
hs_pre_discount_amount
"round_nearest((if is_present(price) then price else 0 * if is_present(quantity) then quantity else 1), if is_present(string(hs_line_item_currency_code)) then if is_present(currency_decimal_places(string(hs_line_item_currency_code))) then currency_decimal_places(string(hs_line_item_currency_code)) else 3 else 3)"
Can be simplified to:
price x quantity
hs_total_discount
"round_nearest(if is_present(discount) then (discount * if is_present(quantity) then quantity else 1)\n
elseif is_present(hs_discount_percentage) then (hs_discount_percentage * 0.01 * if is_present(hs_pre_discount_amount) then hs_pre_discount_amount else 0) else 0, if is_present(string(hs_line_item_currency_code)) then if is_present(currency_decimal_places(string(hs_line_item_currency_code))) then currency_decimal_places(string(hs_line_item_currency_code)) else 3 else 3)"
Can be simplified to either:
discount x quantity
(if the line item is a fixed value)
Or
hs_discount_percentage x 0.01 x hs_pre_discount_amount
(If the discount is a percentage)
amount
"round_nearest(if is_present(hs_sync_amount) then hs_sync_amount else (if is_present(hs_pre_discount_amount) then hs_pre_discount_amount else 0 - if is_present(hs_total_discount) then hs_total_discount else 0), if is_present(string(hs_line_item_currency_code)) then if is_present(currency_decimal_places(string(hs_line_item_currency_code))) then currency_decimal_places(string(hs_line_item_currency_code)) else 3 else 3)
The most common calculation above can be simplified to:
hs_pre_discount_amount - hs_total_discount
Note: hs_sync_amount is set by Ecommerce sync, so it overrides line item calculations and accepts the sync price.
In summary, when the discount is a percentage, HubSpot:
- Calculates the total line item price without discounts (hs_pre_discount_amount)
- Calculates the total line item discount using discount% rounded to two decimal places multiplied by the total line item price (hs_total_discount)
- Net line item price is total line item price - total line item discount (amount)
For more help with pricing, discounts, or quoting inside HubSpot, contact support@hubdo.com