Problem/Motivation
Shipments currently only store the shipping method id and service id from the rate when the shipment was created/updated. This assumes that shipping methods and services never change. In the real world they at least every couple years. When this happens the record of what service was selected for a shipment is lost as the ids no longer map to anything. If a shipping method plugin is removed, it's services change, or a shipping method deleted the record is lost.
See this issue for a real world example of this in action:
#3569675: Shipping Method Format Fails to Display on Order Summary
Steps to reproduce
Create a shipping method. Create a shipment on an order using a rate generated from that shipping method. Delete the shipping method. The service is now no longer visible.
Proposed resolution
Add a field to the shipment to record the service label from the rate. This will preserve the rate as it was displayed at the time the shipment was created.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork commerce_shipping-3570229
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jsacksick commentedI agree on the pricinciple, but this is a broader issue affecting Commerce in general where references are stored rather than a full record.
The same apply to a product variation being removed after it was purchased, or a promotion for example.
Comment #3
rhovlandThis is true, however this and payment methods are the only places where the site administrator has little control over if that reference stays or goes.
While shipping methods can be disabled, if the underlying plugin vanishes (outdated, obsolete, etc) then it has effectively been deleted.
Product variations can be unpublished and kept. Same with promotions. Profiles don't suffer this problem because a copy is made on the order. Orders copy variations to an order item and that order item stays even if the referenced variation goes away.
Comment #6
jsacksick commentedLooks good to me, wondering if we shouldn't make the view display configurable or is that not needed perhaps?
Comment #8
jsacksick commented