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

GraphQL - Return shipping total including tax in shipping method resolver #35338

Closed
wants to merge 4 commits into from

Conversation

liamjtoohey
Copy link

@liamjtoohey liamjtoohey commented Apr 20, 2022

Description (*)

Return shipping total including tax for selected shipping method resolver. Vanilla Magento will always display the shipping price including tax within cart price summary, regardless of tax/calculation/shipping_includes_tax value. This logic is not mirrored in the graphql resolvers, however, as the base shipping amount is returned.

Vanilla Magento checkout with tax/calculation/shipping_includes_tax set to 1:
image

GraphQL cart query for shipping totals with tax/calculation/shipping_includes_tax set to 1:

query getCartDetails($cartId: String!) {
    cart(cart_id: $cartId) {
        shipping_addresses {
            selected_shipping_method {
                amount {
                    value
                    currency
                }
                carrier_code
                carrier_title
                method_code
                method_title
            }
        }
    }
}
{
  "data": {
    "cart": {
      "shipping_addresses": [
        {
          "selected_shipping_method": {
            "amount": {
              "value": 8.33,
              "currency": "GBP"
            },
            "carrier_code": "testshipping",
            "carrier_title": "Shipping",
            "method_code": "testshipping",
            "method_title": "Shipping"
          }
        }
      ]
    }
  }
}

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

  • Setup latest version of M2.4
  • Set tax/calculation/shipping_includes_tax to 1 (or manually define shipping price to "Include Tax" via admin panel)
  • Configure standard tax class/rates of 20% for taxable goods
  • Create test product, assign to taxable goods tax class
  • Set "Flat Rate" shipping method "Enabled" field to "Yes" via admin panel
  • Set "Flat Rate" shipping method "Type" field to "Per Order" via admin panel
  • Set "Flat Rate" shipping method "Price" field to "10" via admin panel
  • Add test product to cart
  • Navigate to checkout, fill in shipping address data, select flat rate shipping method
  • Confirm order summary in checkout and cart lists shipping price as 10
  • Run example graphql query noted in ticket description on the same cart
  • Confirm that value returned is not the same as the value returned in checkout/cart summary

Questions or comments

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. resolves [Issue] Return shipping total including tax #36876: Return shipping total including tax

@m2-assistant
Copy link

m2-assistant bot commented Apr 20, 2022

Hi @liamjtoohey. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ 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

ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.

For more details, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests 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 Pull Requests 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.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@liamjtoohey
Copy link
Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@liamjtoohey
Copy link
Author

@magento run WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Apr 26, 2022
@engcom-Alfa
Copy link
Contributor

@magento create issue

@liamjtoohey
Copy link
Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@liamjtoohey
Copy link
Author

@magento run WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@liamjtoohey
Copy link
Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@liamjtoohey liamjtoohey changed the title Return shipping total including tax GraphQL - Return shipping total including tax in shipping method resolver Feb 20, 2023
@engcom-November
Copy link
Contributor

Hi all,
Development team is currently working on this issue.
Thank you.

@engcom-Alfa
Copy link
Contributor

hey @liamjtoohey

as per retesting our team is unable to reproduce on 2.4 development, hence a kind request if you can please share if anything else we are missing from our end on the given steps of description.

We worked on the issue and issue was not able to reproduce.
Steps folllowed:

  1. Set tax/calculation/shipping_includes_tax to 1
  2. Configured standard tax class/rates of 20% for taxable goods
  3. Create test product, assign to taxable goods tax class
    4 Set "Flat Rate" shipping method "Enabled" field to "Yes" via admin panel
    5 Set "Flat Rate" shipping method "Type" field to "Per Order" via admin panel
    6 Set "Flat Rate" shipping method "Price" field to "5" via admin panel
    7 Added test product to cart
    8 Navigate to checkout, fill in shipping address data, select flat rate shipping method
    9 Confirm order summary in checkout and cart lists shipping price as 5
    image

10 Ran example graphql query noted in ticket description on the same cart
image

And we are getting proper response for query we ran .

@engcom-Alfa engcom-Alfa added the Issue: needs update Additional information is require, waiting for response label Apr 3, 2023
@Priyakshic Priyakshic added the Project: Community Picked PRs upvoted by the community label Feb 12, 2025
@engcom-Hotel
Copy link
Contributor

Hello @liamjtoohey,

Thanks for the contribution!

We re-attempted to reproduce the issue, but we were unable to replicate the original problem that prompted the creation of this PR.

Please review this comment and let us know if we missed any steps necessary to reproduce the issue.

In the meantime, we are placing this PR On Hold.

Thanks

@engcom-Hotel engcom-Hotel added Progress: on hold and removed Issue: needs update Additional information is require, waiting for response labels Feb 21, 2025
@engcom-Hotel
Copy link
Contributor

Hello @liamjtoohey,

This is the gentle reminder to check if you have got chance to check this #36876 (comment). We are unable to reproduce the actual issue, hence we are unable to process this PR further.

Please have a look into it and let us know if we missed anything.

Thanks

@engcom-Hotel
Copy link
Contributor

Hello @liamjtoohey ,

We have noticed that this PR has not been updated for a while. Therefore, we are closing it for now.

Please let us know when you are ready to work on it again, and we will be happy to reopen the PR.

Thank you for your valuable contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Partner: Ampersand partners-contribution Pull Request is created by Magento Partner Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: on hold Progress: review Project: Community Picked PRs upvoted by the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Return shipping total including tax
8 participants