Menu

One cart, several warehouses: how we price delivery when an order ships from more than one place
📰

One cart, several warehouses: how we price delivery when an order ships from more than one place

DEV Community: postgres·RAMO·3 days ago
#x86moQtb
#devtopostgresql#devto#dev#null#delivery
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.