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

fix: missing relation when calculating total for cart, item.adjustments #1862

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

dwene
Copy link
Contributor

@dwene dwene commented Jul 16, 2022

This was incorrectly calculating item prices with discounts applied when creating order from cart.

@dwene dwene requested a review from a team as a code owner July 16, 2022 17:20
@changeset-bot
Copy link

changeset-bot bot commented Jul 16, 2022

⚠️ No Changeset found

Latest commit: 0a65063

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

@srindom
Copy link
Collaborator

srindom commented Jul 19, 2022

@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

@dwene
Copy link
Contributor Author

dwene commented Jul 19, 2022

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?

@dwene
Copy link
Contributor Author

dwene commented Jul 19, 2022

Or are you just saying there's an issue with the unit tests?

@dwene
Copy link
Contributor Author

dwene commented Jul 25, 2022

Aha, found the issue and fixed.

@dwene
Copy link
Contributor Author

dwene commented Jul 25, 2022

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.

@dwene
Copy link
Contributor Author

dwene commented Jul 25, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants