-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Deactivating a shipping method with fees leads to wrong delivery method and payment status in previous orders #5367
Comments
Ok it is worth than I thought.... Those orders:
Had a shipping fee with the shipping method that has no fee, in the order customer report yesterday Today when downloading the report the shipping fee is at 0. I have yesterday's report thanks to the user. When checking those orders we had a very strange effect, the first time one of us would open the order, the shipping fee was displayed. She zoomed too much out sorry: When I came to see that order, or even he she went to see the payment menu and then back to the details, she would see the fee is not there anymore... So I'm guessing cache problems? What's super freaky is that it would mean that there might be quite a lot more orders with the wrong shipping method, and that we have now no ways to find except if we have logs?... |
The problem is this magical code (inherited from spree) that runs when you load the edit order page. For example: I tested now, it doesnt need to be a new order, you can select a ship method in any order, if you unlink the ship method from the distributor of the order and load the edit order page, the order ship method will be updated to an active ship method. BUT, here's the main point, this will only happen if the order was not shipped yet, shipment state 'pending'. If the order is shipped, shipment state "shipped", the inactive ship method will remain assigned to the order.
Anyway, I think it's obvious we want the code to not touch ship method of an order. |
The process is called refresh_shipping_rates and is executed when the order is edited in the backoffice and also when the order customer details are updated. For now I just removed these 2 calls and I'll see what does the build say: these calls may be supporting other processes/details: #5373 |
In this new PR without this refresh rates process on the edit order page, the order keeps assigned to a ship method not linked to the order distributor. I tested shipping the order in the order list page and it just works 👍 Also, the result of the build is pretty straight forward, no major problems detected. Only one spec is broken and makes me realize one important point: with this fix, in the same way the unlinked ship method will not be removed from the order, new linked ship methods will not be available to be selected on the edit orders page. To improve this we could keep running the refresh ship rates process but customize it so that it only adds newly available ship methods to the order and keep all the existing ones (the ones available on checkout) irregardless of them being available now or not. This will be a bit complicated to achieve but can be done. |
@luisramos0 I think it would depend how we define what is a new shipping method. If it is a totally fresh shipping method, it is maybe an edge case to want them on past orders. But not so much to get them when doing a new order in the admin. How does that work? We are talking only about editing here right? The problem I see is if we consider new shipping method, shipping method that have been re-activated. And I wonder if this is what you meant by "linked" shipping method. Indeed, I think we have an issue around what de-activating means.For our users it means "not available in the shopfront". But it's not the code definition right? For the code it's a shipping method that is not used anymore? |
Marking a ship method "backoffice only" was not working but this PR makes it work: #5392 The root cause of this issue is not fixed. I am still wondering if this issue could be considered a feature, not a bug if we understand it as "If a manager edits an order that has not been shipped yet, the shipping methods available for that order will be automatically updated to the the shipping methods currently linked to the order distributor, and if the selected shipping method is not currently linked to the order distributor, it will be changed to a shipping method that is currently linked to the order distributor". Anyway, I think PR #5392 moves this to S3 at least. |
yes awesome :) I wonder if we cannot display something like this "do not edit your shipping method with big changes (completely change the name, de-activate or remove fees) if you have orders with this shipping method that has not been shipped yet". On the shipping method list or edit page (or both). Maybe a bit long :D but at least people see it, it's not just an email we send them and then they forget? |
hmmm, instead of that message I think we should fix the root cause. I said it was complicated but it's just one method we need to re-write: Shipment#refresh_rates |
yes @luisramos0 but there are a lot of s3 to prioritize... including the one where de-activating is making the method disappear for the user... So at least during that time the user has a warning? |
ok, I agree to add the message. |
Quick summary:
So, with these 3 PRs, I think we can now downgrade this to S3 and move it to All the things, ok @RachL? |
@luisramos0 yes perfect! Thank you :) |
Description
This is something that I have found while following hub 922 in French prod.
This hub has 2 delivery method: pickup and delivery by bike. Delivery by bike has a fixed fee of 6 euros.
A typical week for them goes like this:
On Tuesday they open their OC with meat products. Everyone has a choice between home delivery and pick up because they have only a few customers buying meat
On Friday they open their OC with vegetables. A lot more customers are involved, so they open in 2 stages :
When the week start again, they start this cycle again.
However, when they deactivate the home delivery shipping method, all the previous orders display then the only shipping method available : pick up, with no fees. So all these orders are now showing a credit due to the customer of 6 euros, which is wrong: these customer where delivered by bike, so should NOT be refunded the bike fees.
All reports are wrong too.
Steps to Reproduce
Orders on French prod that are incorrect: # R088866556, # R008087351, # R266862838 ... but maybe many that I have troubles to find 😭
To reproduce on staging:
Animated Gif/Screenshot
Workaround
I can't find a workaround. For this week, I thought on changing manually all previous order to refund the correct amount. However this is currently a nightmare because :
Even if it would fix it, I cannot chase all my hubs de-activating shipping methods. So I think we need a proper solution here?
Severity
bug-s2: a non-critical feature is broken, no workaround
Your Environment
Possible Fix
De-activated shipping method should stay available for the previous orders or for the manager when editing an order?
The text was updated successfully, but these errors were encountered: