In the line_items data from Shopify (example shown below), the tax amount listed in the tax_lines is calculated after a discount has been applied. However, there is no discount field present at the individual line_item level, making it unclear how much discount was applied to this product.
? Example line_item Data:
“line_items”: [ { “key”: “41480207401210”, “sku”: “5971”, “grams”: 10000, “price”: “104.00”, “title”: “Blandare 80”, “vendor”: “KGC Verktyg och Maskiner AB”, “taxable”: true, “quantity”: 1, “gift_card”: false, “tax_lines”: [ { “rate”: 0.25, “price”: “17.68”, “title”: “SE Moms”, “source”: “MerchantTaxFinalization”, “position”: 1 } ] } ]
Issue:- The listed price is “104.00”, and the tax rate is 25% (0.25).
-
Based on a 25% tax rate, we would expect the tax to be:
Expected Tax = 104.00 / 1.25 × 0.25 = 20.80
-
However, the tax_lines value shows “17.68” instead.
-
This indicates that a discount has already been applied, but no discount amount or percentage is visible in the line_item.
Recommendation to Shopify:
Shopify should ideally provide the discount amount or percentage at the individual product (line_item) level, especially when it affects the tax calculations. This will allow for:
-
Accurate financial tracking
-
Transparent tax reporting
-
Easier reconciliation of order values
Hello @bahvesh
You’re absolutely right—this is a common point of confusion when working with Shopify’s line_items data structure.
In Shopify, discounts applied at the order or cart level are reflected in the final tax calculations but are not broken down per line_item in the default webhook payload. That’s why, even though the item price is listed as “104.00” and the tax rate is 25%, the actual tax charged is “17.68”, implying a pre-tax discount was applied.
To calculate the actual discount applied per item, you’ll need to:
-
Look into the discount_allocations field within each line_item.
If present, this contains how much of the total discount was allocated to this item.
Example:
"discount_allocations": [
{
"amount": "13.00",
"discount_application_index": 0
}
]
-
Calculate the effective price by subtracting the discount from the line item’s original price.
-
Use this adjusted price to verify or compute the correct tax using the tax rate.
Totally agree with your recommendation—having a dedicated discount_amount or effective_price field at the line_item level would greatly simplify tax reconciliation and reporting.
Until then, checking the discount_allocations (if available) is the best workaround.
Let me know if you have any questions.
Unfortunately, I don’t have discount_allocations field in my webhook line item data. Though i have applied_discounts [ ] field but that too is always empty.