medusa
medusa copied to clipboard
fix: missing relation when calculating total for cart, item.adjustments
This was incorrectly calculating item prices with discounts applied when creating order from cart.
⚠️ No Changeset found
Latest commit: 0a650635389599c3eff80389515956993645bad1
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@dwene - this doesn't seem to work when we include the adjustments in the service; can't seem to figure out exactly what it is that is causing this issue
Hmmm, our issue was that free orders weren't skipping the payment process when completing the cart. When I added that line using the medusa extender, it solved our issue. What isn't working?
Or are you just saying there's an issue with the unit tests?
Aha, found the issue and fixed.
You cant fetch a cart with line_items.adjustments
, insert the adjustments manually, and then save the cart without setting those adjustments on the line items. TypeORM gets confused.
At some point, it would be good to pick one pattern or another. Either update all the entites off cart
in memory, or update them using their individual repositories, not both. I think might be doubling the number of updates called on the database.