You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
while we first setShippingAddress for order, then we choosed a eligible shipping method
but while we changed shipping address to another, maybe before saved shippingLines is not eligible at this time, we have no chance to reset shippingLines
first we need to clear shippingLines for this order. provider us mutation cleanOrderShippingMethod for us.
or while we invoke mutationsetOrderShippingAddress, it will automatically check if current if shippingMethod is eligible` it not remove it automatically.
To Reproduce
Steps to reproduce the behavior:
Go to '...'
Click on '....'
Scroll down to '....'
See error
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
@vendure/core version: 1.3.1
Nodejs version 14+
Database (mysql/postgres etc): mysql
Additional context
The text was updated successfully, but these errors were encountered:
I understand the issue. I think the first solution is better, because with option 2, it assumes that only a change to the shippingAddress will affect eligibility of the current method. However, a ShippingEligibilityChecker is able to perform any arbitrary logic to decide whether a method is eligible. For example, it might be based on the weight of items in the order.
So in order to correctly do an "automatic" check, we would need to run an eligibility check on every change to the Order.
The first method involves more work for the storefront implementation - it needs to decide at which point to remove the current shipping method. But I think that is reasonable.
Another slight variation on this could be to have a verifyOrderShippingMethod mutation which will check whether the current method is still eligible, and if so return true and if not return falseand remove that shippingLine from the Order.
In either case, I will assign this to the next minor milestone since it is not just a bugfix, but involves a new feature.
I just took a deeper look at this. Due to this change which was part of v1.3.4, whenever you execute the setOrderShippingAddress mutation, the order will now be passed through the OrderCalculator which will check the eligibility of the current ShippingMethod. If it is no longer eligible, it will automatically replace the currenct ShippingLine with the next cheapest eligible ShippingMethod.
Based on further discussion on Slack, the behaviour is fine now, but there exists 1 unhandled case:
When the current ShippingMethod becomes ineligible, and there is no other eligible method, the shippingLines should be cleared (set to []). Currently this does not happen - the ineligible method & shippingLines remain on the Order.
Describe the bug
while we first setShippingAddress for order, then we choosed a
eligible
shipping methodbut while we changed shipping address to another, maybe before saved
shippingLines
is noteligible
at this time, we have no chance to resetshippingLines
cleanOrderShippingMethod
for us.setOrderShippingAddress
, it will automatically check if current ifshippingMethod is
eligible` it not remove it automatically.To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: