Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtotal Cart Price Rule excludes product tax #28472

Closed
bamboekeizer opened this issue Jun 2, 2020 · 23 comments
Closed

Subtotal Cart Price Rule excludes product tax #28472

bamboekeizer opened this issue Jun 2, 2020 · 23 comments
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: done Reported on 2.3.3 Indicates original Magento version for the Issue report.

Comments

@bamboekeizer
Copy link

Preconditions (*)

Magento ver. 2.3.5-p1 - upgraded from 2.3.3 using composer

  1. Product price includes product tax. Product tax is 21%. Shipping table rate is 6 euro.
  2. Create subtotal cart price rule to have free shipping start from 99 euro. Use 0 discount either as fixed value or percentage, tried both configurations
  3. Shipping costs set to 6 euro from table rates

Steps to reproduce (*)

  1. As customer, add a product to the cart of 102 euro
  2. Go to checkout
  3. Look at the shipping costs displayed as part of the cart price
  4. The shipping costs remain on 6 euro
  5. The order total is product price + shipping costs = 102 + 6 euro

Expected result (*)

  1. At checkout, the subtotal cart rule should evaluate the product price including tax, being 102
  2. The subtotal cart rule applies the free shipping and 0 discount
  3. The order total is only product price and has 0 shipping costs: 102 euro

Actual result (*)

  1. At checkout, the subtotal cart rule should evaluate the product price including tax, being 102 euro
  2. The subtotal cart rule does not apply the free shipping and 0 discount
  3. The order total remains at product price and 6 euro shipping costs: 108 euro

  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
@m2-assistant
Copy link

m2-assistant bot commented Jun 2, 2020

Hi @bamboekeizer. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jun 2, 2020
@magento-engcom-team
Copy link
Contributor

Hi @bamboekeizer. Thank you for your request. I'm working on Magento 2.4-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @bamboekeizer, here is your Magento instance.
Admin access: https://i-28472-2-4-develop.instances.magento-community.engineering/admin_a0ab
Login: b3d8be9e Password: fac8c1affc86
Instance will be terminated in up to 3 hours.

@Esteraa
Copy link

Esteraa commented Jun 3, 2020

We have the same issue on Magento 2.3.5-p1. For a workaround I changed the free shipping amount to the subtotal price - tax.

@bamboekeizer
Copy link
Author

@magento give me 2.3.5-p1 instance

@magento-engcom-team
Copy link
Contributor

Hi @bamboekeizer. Thank you for your request. I'm working on Magento 2.3.5-p1 instance for you

@magento-engcom-team
Copy link
Contributor

Hi @bamboekeizer, here is your Magento instance.
Admin access: https://i-28472-2-3-5-p1.instances.magento-community.engineering/admin_f71f
Login: 24628926 Password: bef83902a39b
Instance will be terminated in up to 3 hours.

@bamboekeizer
Copy link
Author

bamboekeizer commented Jun 3, 2020

Reproduced successfully on 2.3.5-p1

@VigneshVenkatesan154 VigneshVenkatesan154 self-assigned this Jun 4, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jun 4, 2020

Hi @VigneshVenkatesan154. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@ruthgeridema
Copy link

Also having this issue. Reproduced on 2.3.5-p1.

Temporary workaround is:
$amount / 1,{$taxrate}. So in NL (21%) with 20$ MOQ:
20/1,21 = 16,53. If you fill this in your good.

@cproboscht
Copy link

Also having this issue in 2.3.5-p1.
Got second problem which is according to this one: we have the issue, that free shipping is also calculated without tax #13392
we did not have this in 2.3.4-p2 and so we investigated changes:

found this:
vendor\magento\module-tax\Model\Sales\Total\Quote\CommonTaxCollector.php Line 596FF
$address = $shippingAssignment->getShipping()->getAddress();
$address->setBaseSubtotalTotalInclTax($baseSubtotalInclTax);
$address->setSubtotal($total->getSubtotal());
$address->setBaseSubtotal($total->getBaseSubtotal());

removed
$address->setSubtotal($total->getSubtotal());
$address->setBaseSubtotal($total->getBaseSubtotal());
for test and both issues where fixed?!

pixelhed added a commit to pixelhed/magento2 that referenced this issue Aug 3, 2020
Calculation was not based on correct value
magento#28472
@k4emic
Copy link

k4emic commented Sep 2, 2020

@magento give me 2.3.5-p2 instance

@magento-engcom-team
Copy link
Contributor

Hi @k4emic. Thank you for your request. I'm working on Magento 2.3.5-p2 instance for you

@magento-engcom-team
Copy link
Contributor

Hi @k4emic, here is your Magento instance.
Admin access: https://i-28472-2-3-5-p2.instances.magento-community.engineering/admin_3d2c
Login: fee6df65 Password: 940632d1e907
Instance will be terminated in up to 3 hours.

@k4emic
Copy link

k4emic commented Sep 2, 2020

@magento give me 2.3.5-p1 instance

@magento-engcom-team
Copy link
Contributor

Hi @k4emic. Thank you for your request. I'm working on Magento 2.3.5-p1 instance for you

@magento-engcom-team
Copy link
Contributor

Hi @k4emic, here is your Magento instance.
Admin access: https://i-28472-2-3-5-p1.instances.magento-community.engineering/admin_29e6
Login: d501ef65 Password: 9518be51ad2f
Instance will be terminated in up to 3 hours.

@k4emic
Copy link

k4emic commented Sep 3, 2020

Also reproducible on 2.3.5-p2.

We worked around this by introducing a new condition option

--- Model/Rule/Condition/Address.php	2020-09-03 12:01:26.000000000 +0200
+++ Model/Rule/Condition/Address.php	2020-09-03 12:53:46.000000000 +0200
@@ -62,7 +62,8 @@
     {
         $attributes = [
             'base_subtotal_with_discount' => __('Subtotal (Excl. Tax)'),
-            'base_subtotal' => __('Subtotal'),
+            'base_subtotal' => __('Subtotal (Avoid this one: Known to be unreliable for most tax settings)'),
+            'base_subtotal_total_incl_tax' => __('Subtotal (Incl. Tax)'),
             'total_qty' => __('Total Items Quantity'),
             'weight' => __('Total Weight'),
             'payment_method' => __('Payment Method'),

@koenner01
Copy link
Contributor

Bumping this ticket as this is quite a critical feature.

The descriptive labels on the address attributes are just plain wrong. The first option was introduced in #21288 but this clearly was a mistake and never properly tested.

The suggestion of @k4emic is going towards the right direction with adding the correct option but the labels are still not very descriptive for the excluding tax options.

@grassst
Copy link

grassst commented Sep 19, 2020

I also have the same problem on 2.3.5-p2.
We are using at least two tax clases. So for us changing the values in the table rate CSV is no option for us.
@k4emic can you please tell me what I have to do to get your work arround running in my system? I changed vendor/magento/module-sales-rule/Model/Rule/Condition/Address.php as you described, but where can i find this new condition to choose?

thank you!

@willtran
Copy link

willtran commented Oct 6, 2020

I believe I am seeing the same problem.
Found inconsistency here vendor/magento/module-quote/Model/Quote/Address.php:1031

$request->setPackageValue($item ? $item->getBaseRowTotal() : $this->getBaseSubtotal());

$this->getBaseSubtotal() should be $this->getBaseTotal() or

$item-getBaseRowTotal should be $item->getBaseSubtotal()

@sdzhepa
Copy link
Contributor

sdzhepa commented Oct 13, 2020

Duplicate of #29740

@sdzhepa sdzhepa closed this as completed Oct 13, 2020
@magento-engcom-team magento-engcom-team added the Reported on 2.3.3 Indicates original Magento version for the Issue report. label Nov 13, 2020
@pixel-paul
Copy link

pixel-paul commented Nov 23, 2020

This persists in 2.3.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Progress: done Reported on 2.3.3 Indicates original Magento version for the Issue report.
Projects
Archived in project
Development

No branches or pull requests