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

Customer Sales Order Item GraphQL Resolver does not honor tax configuration #36946

Closed
1 of 5 tasks
pmzandbergen opened this issue Mar 2, 2023 · 14 comments · Fixed by #36966
Closed
1 of 5 tasks

Customer Sales Order Item GraphQL Resolver does not honor tax configuration #36946

pmzandbergen opened this issue Mar 2, 2023 · 14 comments · Fixed by #36966
Assignees
Labels
Area: Order Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Project: GraphQL Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@pmzandbergen
Copy link
Contributor

Preconditions and environment

  • Magento 2.x (including the current 2.4-develop branch)
  • Tax configured, all display settings on "Including Tax" (See Stores > Configuration > Sales > Tax)

Steps to reproduce

  1. Create a Customer
  2. Create an Order as Customer, including a Product with Tax included
  3. Run the following GraphQL query as this Customer:
query {
    customer {
        orders {
            items {
                number
                items {
                    quantity_ordered
                    product_sale_price {
                        value
                    }
                }
                total {
                    subtotal {
                        value
                    }
                    total_tax {
                        value
                    }
                    base_grand_total {
                        value
                    }
                }
            }
        }
    }
}

Current result:

{
    "data": {
        "customer": {
            "orders": {
                "items": [
                    {
                        "number": "SOME-ORDER-NUMBER",
                        "items": [
                            {
                                "quantity_ordered": 1,
                                "product_sale_price": {
                                    "value": 49.58
                                }
                            }
                        ],
                        "total": {
                            "subtotal": {
                                "value": 49.58
                            },
                            "total_tax": {
                                "value": 10.41
                            },
                            "base_grand_total": {
                                "value": 59.99
                            }
                        }
                    }
                ]
            }
        }
    }
}

The field product_sale_price should include tax, since all display settings (especially tax/sales_display/price) include tax.

Expected result

The price (product_sale_price) should include tax with tax/sales_display/price set.

Actual result

The price (product_sale_price) is excluding tax with tax/sales_display/price set.

Additional information

The cause can be found in the DataProvider:
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/SalesGraphQl/Model/OrderItem/DataProvider.php#L142

It does not honor the configuration, it simply uses $orderItem->getPrice(). Depending on the setting it should be either using $orderItem->getPriceInclTax() or $orderItem->getPrice().

If required separate fields should be used, e.g.:

  • product_sale_price (the display price as configured; existing)
  • product_sale_price_excl_tax (the price excluding tax; new)
  • product_sale_price_incl_tax (the price including tax; new)

However these additional fields should not be necessary in the current (known) use cases.

Note: If I have time I'll submit a PR.

Release note

No response

Triage and priority

  • 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”.
@m2-assistant
Copy link

m2-assistant bot commented Mar 2, 2023

Hi @pmzandbergen. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@m2-assistant
Copy link

m2-assistant bot commented Mar 2, 2023

Hi @engcom-Bravo. 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).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas 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.

@engcom-Bravo engcom-Bravo added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Mar 2, 2023
@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2023

Hi @engcom-Lima. 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).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas 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.

@engcom-Lima
Copy link
Contributor

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Lima
Copy link
Contributor

✔️ Issue confirmed

Issue got reproduced in 2.4-develop branch.

Description: Customer sales order item in GraphQl is not displaying tax properly.

Pre-requisite:
Fresh magento 2.4-develop should be installed.

Steps to reproduce:
As given in comment.

Expected result: The price (product_sale_price) should include tax with tax/sales_display/price set.

Actual result: The price (product_sale_price) is excluding tax with tax/sales_display/price set.
Screenshots:
Screenshot 2023-03-03 at 5 08 05 PM

@engcom-Lima engcom-Lima added Component: GraphQL GraphQL Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: Order Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Mar 3, 2023
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Confirmed in Issue Confirmation and Triage Board Mar 3, 2023
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-8104 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Mar 3, 2023

✅ Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@pmzandbergen
Copy link
Contributor Author

@magento I am working on this

pmzandbergen added a commit to pmzandbergen/magento2 that referenced this issue Mar 5, 2023
Fix for issue magento#36946 (Jira ticket AC-8104): Include Tax for Product Price if `\Magento\Tax\Helper\Data::displaySalesPriceInclTax(...)` returns `true`
@pmzandbergen
Copy link
Contributor Author

PR #36966 is ready for review

@engcom-Charlie engcom-Charlie added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Mar 7, 2023
@m2-community-project m2-community-project bot added this to Pull Request In Progress in High Priority Backlog Mar 7, 2023
@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Ready for Development in High Priority Backlog Apr 5, 2023
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Apr 10, 2023
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Apr 10, 2023
@glo23503
Copy link
Contributor

Internal team is working on it.

@pmzandbergen
Copy link
Contributor Author

Internal team is working on it.

@glo23503 should I still add a unit test for the PR or is it already created by the internal team?

@m2-community-project m2-community-project bot moved this from Pull Request In Progress to Ready for Development in High Priority Backlog Apr 12, 2023
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Apr 25, 2023
@m2-community-project m2-community-project bot moved this from Ready for Development to Pull Request In Progress in High Priority Backlog Apr 25, 2023
@glo23503
Copy link
Contributor

glo23503 commented May 23, 2023

Our internal team is working on the test coverage.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Order Component: GraphQL GraphQL Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: done Project: GraphQL Reported on 2.4.x Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Development

Successfully merging a pull request may close this issue.

7 participants