Most delivery-fee tutorials assume one warehouse. You set a flat fee, add a free-shipping threshold, done. Our store doesn't work like that. A single cart on ramo.co.il can mix things that physically leave from different places: a few bags of potting soil from one storage, a stepping stone from another, a tube of glue from a third. Each of those places has its own trucks, its own rules and its own idea of what a delivery costs.
This post is about the model we ended up with, and about one boring bug class that kept coming back: settings that were simply never filled in.
Delivery belongs to the storage, not to the store
The first version had store-wide settings: one fee, one threshold. It fell apart the moment a second supplier warehouse joined, because "free delivery above X" means nothing if half the cart ships separately and someone still has to pay for that truck.
So delivery settings moved down a level.…