The base article: How is discount_tax_compensation_amount calculated?
Step 1
Step 2
Details:
- How is
\Magento\Tax\Model\Config::applyTaxAfterDiscount()implemented and used? - How is the «Apply Customer Tax» («Before Discount» / «After Discount») option handled?