magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Fix: Allow to fetch tax class ID for NOT LOGGED IN customer group

Open thomas-kl1 opened this issue 9 months ago • 15 comments

Description (*)

When using \Magento\Catalog\Helper\Data::getTaxPrice to fetch price, tax details are miscalculated for context with guest users.

Here the group id 0 was interpreted as NULL while it shouldn't.

Contribution checklist (*)

  • [ ] Pull request has a meaningful description of its purpose
  • [ ] All commits are accompanied by meaningful commit messages
  • [ ] All new or changed code is covered with unit/integration tests (if applicable)
  • [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ ] All automated tests passed successfully (all builds are green)

Resolved issues:

  1. [x] resolves magento/magento2#39850: Fix: Allow to fetch tax class ID for NOT LOGGED IN customer group

thomas-kl1 avatar Apr 16 '25 15:04 thomas-kl1

Hi @thomas-kl1. Thank you for your contribution! Here are some useful tips on how you can test your changes using Magento test environment. :exclamation: Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s) For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here :information_source: Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation. Join Magento Community Engineering Slack and ask your questions in #github channel.

m2-assistant[bot] avatar Apr 16 '25 15:04 m2-assistant[bot]

@magento create issue

engcom-Hotel avatar Apr 22 '25 11:04 engcom-Hotel

@magento run all tests

thomas-kl1 avatar Jul 18 '25 12:07 thomas-kl1

@magento run all tests

engcom-Hotel avatar Sep 15 '25 06:09 engcom-Hotel

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE, Integration Tests, Unit Tests

engcom-Hotel avatar Sep 15 '25 12:09 engcom-Hotel

Hello @thomas-kl1,

Gentle reminder for this PR.

Thank you.

engcom-Hotel avatar Oct 06 '25 09:10 engcom-Hotel

@engcom-Hotel it's on my todo list!

thomas-kl1 avatar Oct 07 '25 17:10 thomas-kl1

Updated the test coverage in integration test to cover the PR changes.

engcom-Charlie avatar Nov 26 '25 14:11 engcom-Charlie

@magento run all tests

engcom-Charlie avatar Nov 26 '25 14:11 engcom-Charlie

Hello @thomas-kl1,

Thanks for the contribution!

The code changes seems fine to us, but please add/update the automated test with the modified logic.

Thanks

@engcom-Hotel, I have taken care of the test coverage and the static test failures, requesting for the review.

engcom-Charlie avatar Nov 26 '25 16:11 engcom-Charlie

@magento run all tests

engcom-Charlie avatar Nov 26 '25 16:11 engcom-Charlie

@magento run Functional Tests B2B, Functional Tests CE, Functional Tests EE

engcom-Hotel avatar Nov 27 '25 07:11 engcom-Hotel

Hi @thomas-kl1,

Thanks for the collaboration & contribution!

:heavy_multiplication_x: QA not Passed

We have tried to reproduce the issue and the issue was reproducible but after taking PR changes still tax not getting applied for NOT LOGGED IN Customer.We have tried with the below steps :

Screenshot 2025-11-28 at 3 35 09 pm Screenshot 2025-11-28 at 3 34 20 pm Screenshot 2025-11-28 at 2 38 03 pm

Could you please let us know still if we are missing anything.

Thanks.

engcom-Bravo avatar Nov 28 '25 10:11 engcom-Bravo

@engcom-Bravo Hello, regarding your screenshots I'm not sure to understand what the issue is, you've setup a 0 tax for guests. I don't see any tax details in the order summary, so it seems there is no tax as exepected.

Did you enabled Display Zero Tax Subtotal?

thomas-kl1 avatar Dec 02 '25 09:12 thomas-kl1

Hi @thomas-kl1,

Thanks for your Contribution!!.

We have tried to reproduce the issue in Latest 2.4-develop instance we are able to reproduce the issue but after taking PR changes still tax not getting applied for NOT LOGGED IN Customer.We have tried with the below steps :

Created Tax Zones and Rates :

Screenshot 2025-12-05 at 3 43 17 pm

Created a Tax Rule for NOT LOGGED IN Customer with 10% Tax :

Screenshot 2025-12-05 at 3 44 48 pm Screenshot 2025-12-05 at 3 44 55 pm

Tax was still not getting applied for NOT LOGGED IN Customer.

Screenshot 2025-11-28 at 2 38 03 pm

As discussed over the slack we need more information regarding steps to reproduce and please let us know if we are missing anything here and also Could you please resolve the conflicts to proceed further

Thanks.

engcom-Bravo avatar Dec 05 '25 10:12 engcom-Bravo