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

Shipping methods are never removed when line item is removed or added from cart #4707

Closed
SimonsThijs opened this issue Aug 7, 2023 · 0 comments · Fixed by #4715
Closed

Comments

@SimonsThijs
Copy link
Contributor

SimonsThijs commented Aug 7, 2023

Bug report

Describe the bug

When you remove something from your shopping cart the shipping method should be deleted because it needs to be recalculated. This bug can lead to cases where the shipping costs are too low or too high. To prevent this from happening you want the shipping methods to be deleted when an item is added or removed to the cart.

For the removal of an item there is code that does this but it never gets called because "shipping_methods" is never fetched from the database. E.g. this line of code can never be reached because "shipping_methods" is not retrieved

await this.shippingOptionService_

Note that adding an item or updating an item in the cart should also remove the shipping method from the cart. There is currently no code that does this.

System information

Medusa version (including plugins): 1.13.1-beta-20230727162508 (i checked and the bug is also in the latest non beta version)
Node.js version: v20.2.0
Database: Postgres
Operating system: MacOS

Steps to reproduce the behavior

  1. Set up a shipping method that calculates the price based on the items in the cart
  2. Put something in your cart
  3. Go to checkout
  4. Fill out shipping address and calculate the shipping price
  5. Go back to the store and add another item to the cart
  6. Go back to checkout
  7. Shipping price is still based on the old items in the cart from step 4.

Expected behavior

  1. Set up a shipping method that calculates the price based on the items in the cart
  2. Put something in your cart
  3. Go to checkout
  4. Fill out shipping address and calculate the shipping price
  5. Go back to the store and add another item to the cart
  6. Go back to checkout
  7. Shipping price is recalculated based on the new cart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant