-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
(fix) Variants changed from managed inventory to unmanaged are now fulfillable #14056
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?
(fix) Variants changed from managed inventory to unmanaged are now fulfillable #14056
Conversation
🦋 Changeset detectedLatest commit: ec71ad3 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 |
|
@vethan 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 is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on November 17
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.
| ) | ||
|
|
||
| quantity = MathBN.div(quantity, iitem!.required_quantity) | ||
| if(iitem) |
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: Prevent Crashes from Undefined Inventory Data
The find operation crashes when iitems contains undefined elements because it tries to access i.inventory.id on undefined. The PR description mentions "inventory items list containing undefined", but the fix only adds a null check after the find completes. The find itself needs to filter out undefined elements first (e.g., using i?.inventory?.id) to prevent runtime errors before reaching the new null check.
Summary
What — What changes are introduced in this PR?
Null check on inventory items during fulfiment quantity calculation
Why — Why are these changes relevant or necessary?
Currently, under certain conditions a variant can end up with the inventory items list having a length greater than 1, but containing undefined in the list, or the fulfilment not having an associated inventory item id. This change fixes this case
Checklist
Please ensure the following before requesting a review:
yarn changesetand follow the promptsAdditional Context
Add any additional context, related issues, or references that might help the reviewer understand this PR.
Note
Add null check before dividing fulfillment quantity by
required_quantityto avoid errors when matching inventory items, and add a patch changeset.packages/core/core-flows/src/order/workflows/mark-order-fulfillment-as-delivered.ts):iitemexists beforeMathBN.div(quantity, iitem.required_quantity)..changeset/dull-donkeys-ring.md):@medusajs/core-flowsnoting fix for fulfillability when inventory items are unmanaged.Written by Cursor Bugbot for commit ec71ad3. This will update automatically on new commits. Configure here.