Stemming from a conversation with @spencern, we've decided to break #2724 into two: Removing the hard coded zeroth indexes and making order shipping fulfillment flow more flexible and extensible.
This is part 1 of that: removing the hard coded zeroth indexes from the billing/shipping arrays in the order object.
In order for the current code to be marketplace ready, we need to remove hard coded indexes to allow for multiple shipment/billing support.
@kieha and I discussed the direction to take for this.
The first step being that we need a way to identify which shipping/billing object we should be looking at for any given method. Typically that should be identifiable by finding a shipping/billing object that matches the shopId of the active shop.
We also need to consider support for multiple billing or shipping objects per shopId as it's possible for a single shop to split shipments and for a checkout to have multiple payments for a single shop (e.g. gift card, discount, and credit card)
Also important to note that the current implementation for shipping objects does not include a shopId so it is currently impossible to figure out which would apply to a specific shop. This probably needs to get fixed/finished before we can go too far down this path.
I am currently working to remove all shipping[0] references from the cart to order process through order completion. I expect to be able to open a PR for this very soon.
@kieha @zenweasel are you guys syncing up on this to make sure you're not duplicating work between #2813 and whichever issue @zenweasel is using for his work on this?
@spencern I was just planning on dealing with any merge conflicts that came down the pike as I had expected this PR to have been merged by now. Just taking a quick scan of it, it's not really overlapping with the work I am doing.
Most helpful comment
I am currently working to remove all
shipping[0]references from the cart to order process through order completion. I expect to be able to open a PR for this very soon.