Skip to content

Price including Tax and Row Total Including Tax are incorrect after the Discount appliance #35243

Open
@riversy

Description

@riversy

Preconditions (*)

  1. Vanilla Magento Community 2.4.3-p1 with Sample Data
  2. The following settings are applied:
tax/cart_display/subtotal =>3
tax/cart_display/price =>3
tax/calculation/apply_after_discount => 1

image

image

Steps to reproduce (*)

  1. Set Default Tax applied to products with Tax Class “Taxable Goods“ to 20%
  2. Create a test product with a Price of 100$ and Tax Class “Taxable Goods”
  3. Create Cart Price Rule with Coupon “Fix5” which provides a discount of 5%
  4. Go to the storefront and add the Test product to the shopping cart
  5. Proceed to the Payment Method Step
  6. Verify the totals

Expected result (*)

image

Totals
Cart Subtotal Excl. Tax: $100.00
Cart Subtotal Incl. Tax: $119.00
Discount (fix5): -$5.00
Shipping Flat Rate - Fixed: $5.00
Tax: $19.00
Order Total: $119.00

Quote Item Data

select sku, name, qty, base_price, tax_amount, base_price_incl_tax, base_row_total, base_row_total_incl_tax
from quote_item
where quote_id = 3;

+-------------------------+-------------------+------+----------+----------+-------------------+--------------+-----------------------+
|sku                      |name               |qty   |base_price|tax_amount|base_price_incl_tax|base_row_total|base_row_total_incl_tax|
+-------------------------+-------------------+------+----------+----------+-------------------+--------------+-----------------------+
|Sample_100_dollar_product|Sample 100$ product|1.0000|100.0000  |19.0000   |119.0000           |100.0000      |119.0000               |
+-------------------------+-------------------+------+----------+----------+-------------------+--------------+-----------------------+

Actual result (*)

image

Totals
Cart Subtotal Excl. Tax: $100.00
Cart Subtotal Incl. Tax: $120.00
Discount (fix5): -$5.00
Shipping Flat Rate - Fixed: $5.00
Tax: $19.00 Order
Total: $119.00

Quote Item Data

select sku, name, qty, base_price, tax_amount, base_price_incl_tax, base_row_total, base_row_total_incl_tax
from quote_item
where quote_id = 3;

+-------------------------+-------------------+------+----------+----------+-------------------+--------------+-----------------------+
|sku                      |name               |qty   |base_price|tax_amount|base_price_incl_tax|base_row_total|base_row_total_incl_tax|
+-------------------------+-------------------+------+----------+----------+-------------------+--------------+-----------------------+
|Sample_100_dollar_product|Sample 100$ product|1.0000|100.0000  |19.0000   |120.0000           |100.0000      |120.0000               |
+-------------------------+-------------------+------+----------+----------+-------------------+--------------+-----------------------+

Cart Subtotal Incl. Tax is not correlating to the subtotal and final tax.

Reference

According to the following documentation, the actual tax amount is expected to be added to the subtotal instead of the original: https://docs.magento.com/user-guide/configuration/sales/tax.html

image

The place to fix the issue in the source code:

$rowTotalInclTax = $rowTotal + $rowTaxBeforeDiscount;

The following code:

$rowTotalInclTax = $rowTotal + $rowTaxBeforeDiscount;

Should be:

$rowTotalInclTax = $rowTotal + $rowTax;

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: TaxComponent: TaxIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: PR in progressReported on 2.4.3-p1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions