I see there is discount_tax_compensation_amount field in the sales_order_item table. For what purposes this attribute is?


It is used by Magento to calculate the amount of tax that is not originally calculated when a product that has a tax is under discount. For example. Let’s suppose you have a product named “Pencil”. Ant this “Pencil” has a price of $100.00 and a tax of 16%, then the final price will be $116. Now for example you decided to create a coupon code with 10% off in all the Pencils and (This is important) your store is configured to calculate the discount after tax. The user will see a final price including tax of 104.4 that is the result of 116 – 11.6. And that is correct. But legally you can’t discount any amount from tax because your base tax is still 100 and not 104.4. Then Magento hides that quantity of money in hidden_tax_amount. For accounting purposes this process is correct. Then you can show that value as Tax.

In Magento 2, they renamed the fields to make more sense, from hidden_tax_amount to discount_tax_compensation_amount.

Reference : https://blog.taxjar.com/sales-tax-discounts-coupons-promotions/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.