-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Added shipping method data to tax module context #13747
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
base: develop
Are you sure you want to change the base?
Added shipping method data to tax module context #13747
Conversation
🦋 Changeset detectedLatest commit: 5b572c9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 74 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@pepijn-vanvlaanderen is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
name: method.name, | ||
shipping_option_id: method.shipping_option_id, | ||
amount: method.amount, | ||
})), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Tax Context Mismatch Causes Incorrect Calculations
The tax context is populated from orderOrCart.shipping_methods
, but the step's shippingMethods
parameter is used for tax calculation. This inconsistency can lead to the tax context containing different shipping methods than those actually being taxed, potentially causing incorrect calculations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Will be merged for the next release. If you can in the meantime, it would be nice to have this covered by a test
Summary
What — What changes are introduced in this PR?
Added shipping method data to the normalize tax module context.
Why — Why are these changes relevant or necessary?
We need to override the tax provider to set taxes based on the shipping method (when it is a pickup). I.e. we have pickup locations in the Netherlands, but we also ship abroad. When someone from Germany chooses to pickup, the tax needs to be overriden to the Dutch VAT.
To make this possible we need the shipping method data in the taxCalculationContext of the getTaxLines in the CustomTaxProvider.
How — How have these changes been implemented?
Extensions have been made to the
normalizeTaxModuleContext
functionTesting — How have these changes been tested, or how can the reviewer test the feature?
We implemented the patch locally and seen the data passed through properly.
Examples
Provide examples or code snippets that demonstrate how this feature works, or how it can be used in practice.
This helps with documentation and ensures maintainers can quickly understand and verify the change.
Checklist
Please ensure the following before requesting a review:
yarn changeset
and follow the prompts