CD Baby rewrite : shipping costs are the most complicated thing in the world

by Derek Sivers

Wouldn't it be nice if we would just tell the customer, at time of purchase, "We'll ship this thing you've ordered at the lowest rate possible, and bill you exactly what it turns out to cost." But nooooo.... people want you to PREDICT what it's going to cost!

RIGHT NOW : CD Baby only sells CDs, only from one warehouse, so we can predict the shipping cost pretty easily.

BUT SOON : CD Baby will have multiple warehouses in different countries *and* allow some musicians to ship items directly from them to the customer *and* allow the customer to split up their order to have some items sent to multiple addresses.

SO... guess what we have to know now?

#1 - what country the customer is having this item shipped to

#2 - warehouse_stock for this item - (to know closest warehouse that has it)

#3 - what shipping methods are allowed from that warehouse to their country (fedex, usps, etc)

#4 - cost to ship that item from that warehouse by that method to their country

#5 - which of those shipping options (from #3) the customer chooses

#6 - what other warehouse items are in order, so for example we can give discount if 50 different items going from one warehouse in one shipment

#7 - how much of a discount to give, for that. (or, what the ship-cost for that many items is)


Haven't written the code, yet, to calculate all of this. It's a little daunting.

Been there? Done that?


3 Comments

MichelleUK
2005-01-28 05:49:22
Shipping by Artist
Hi Derek,


My heart sank when I heard that you will be allowing artists to ship the CD's directly.


I had a bad experience with CCNow where the artists "team" did not have enough money when they took my CD's to the Post Office. So, although I had paid for speedy delivery to the UK, they sent it via a very slow boat!


After a month, and no show, CCNow gave me my money back and I bought the CD's from CDBaby instead. The CDBaby ones arrived 4 days after ordering by AirMail


Maybe I was unlucky but I would worry about the artist doing it themselves (one mistake on that little customs form and I end up paying a fortune just to get the CD's into the country!)


Anyway, would you be making it clear at order time where the CD's were coming from so that the buyer could decide for themsleves?


Thanks,


Michelle

dereksivers
2005-01-28 06:59:24
Shipping by Artist
>My heart sank when I heard that you will be allowing artists to ship the CD's directly


No - don't worry. Not the CDs but the "other stuff" like clothes, posters, and corn-cob-pipes. All the "merch" that bands also sell but I have no desire to carry here. And it will be made VERY clear that this is an item not coming from us, but directly from the artist. (Kinda like Amazon's "used booksellers" section.)

catsoup
2005-04-12 10:36:52
Rule-based programming
Derek,


Thanks for the inside view of your development process.


I've been using PostgreSQL for years, but I'm a recent convert to Ruby on Rails, so I'm still learning that part.


The idea of writing code for all of the possible shipping variations is daunting, to say the least. You might want to consider using a rule-based system instead, where you just maintain a table of rules, and write one chunk of code that figures out which rules to apply to a specific shipment.


That way you can encapsulate the rating logic and maintain it more easily. And if you have to add to the rule engine later, the interface from the rest of the system never needs to know about.


Good Luck!