Open Alexnortung opened 11 months ago
I stumbled upon this as well, could you resolve the issue?
I tried this when updating the address:
const updatedCart = await updateCart(cartId, data)
if (updatedCart!.shipping_methods.length) {
await updateCart(cartId, { shipping_methods: [] })
}
revalidateTag("cart")
But it's not possible to update the shipping_method of a cart
I think I got it working with this code:
const updatedCart = await updateCart(cartId, data)
if (updatedCart!.shipping_methods.length) {
await setShippingMethod(updatedCart!.shipping_methods[0].shipping_option_id)
}
revalidateTag("cart")
Bug report
Describe the bug
It is possible for a customer to change their shipping address once they have created a shipping method. This behavior is in my opinion okay. The problem arises if the price is dynamically calculated, since changing the shipping address should also recalculate the shipping price.
System information
Medusa version (including plugins): ^1.16.1 Node.js version: 18 Database: Postgres Operating system: NixOS
Steps to reproduce the behavior
canCalculate
method return truecalculatePrice
method 0 if the postal code on the cart's shipping address is '1234' and make it return 100 otherwiseExpected behavior
I would expect that the dynamically calculated shipping methods would either be destroyed or recalculated based on the new cart data.