Fix cart price null crash#15935
Conversation
🦋 Changeset detectedLatest commit: a39c8ec The changes in this PR will be included in the next version bump. This PR includes changesets to release 80 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 |
|
Thanks for the contribution! A few items need to be addressed before this can move forward: The one-line code fix is sound and minimal: guarding calculatedPriceSet before reading calculated_amount prevents the TypeError, and the pre-existing priceNotFound check still surfaces the intended INVALID_DATA error. Two things need fixing before approval: the changeset content is incorrect, and the PR template's Testing section is not filled in. A regression test would also strengthen this core-flow change.
Triggered by: new PR opened |
|
Thanks for the contribution! We need more information before reviewing this further. Good progress since the prior review: the changeset now correctly targets @medusajs/core-flows and a regression test was added for the variant-without-price path. The one-line guard is sound and lets the flow surface the intended INVALID_DATA error instead of a 500. One item from the prior review is still open: the PR description does not follow the template and the Testing section is not filled in. Triggered by: new commit pushed |
Fixes a runtime crash in POST /store/carts/{id}/line-items when a variant exists but has no calculated price for the cart’s region/currency. The code previously accessed calculatedPriceSet without checking for existence, causing a TypeError and resulting in a 500 error instead of a proper validation error.
This change adds a guard for calculatedPriceSet and ensures the flow returns the intended INVALID_DATA error for missing variant prices.