Carts are orders.

By Filippo Conforti on April 09, 2024

The shopping cart concept is derived from real life shopping: When you're buying in a store, it's just impractical to shop all over the shelves while carrying all the stuff with you. That's why you need a shopping cart or bag as a container. When you're all done shopping, you take your cart to the cashier to pay for your goods and rearrange the cart before leaving the store.

Online shopping is different. While you may need a container to temporarily store all the items you want to buy, once you check out, you will only place an order with the merchant, who will eventually ship the items when ready.

Placing an order is very different from buying something in person. So why do ecommerce platforms mimic the cart model? Is it really necessary? The goal is to make buying easy and quick, so why not let customers create an order as soon as they decide to purchase something?

As it turned out, my co-founder Massimo and I decided not to create a cart resource in Commerce Layer. We defined carts as draft orders instead. Carts are empty orders that can be filled with line items whenever an add to cart button is pressed. Checkout is where the customer's information is added to the order, such as their shipping, billing, delivery, and payment methods. After the order has everything it needs, it can be placed. And there's more to the story.

The order must be shipped to the customer, so it must be assigned to a shipping carrier and the stock location that will handle pick-pack-ship. It may be necessary to split the order into multiple shipments or consignments if the order items are distributed across multiple locations. The same applies to a marketplace model, where different vendors must fulfill parts of the same order. In case of subscriptions, the same order is placed and fulfilled repeatedly.

Throughout the ordering process, customers can change their minds, abandon their cart before completing the checkout, request an edit after the order has been placed, or return it after it's been shipped.

The traditional cart model works fine if you have a straightforward use case that moves from cart to checkout to fulfillment without deviations. The reality, though, is much different. There are so many ways the order can go back and forth in the pipeline. All those situations can get complicated if you use a cart model. Instead, a simple order model that just changes its state and content makes all those scenarios much easier to manage.

Again, it's easy to assume something should work a certain way just because it's always been done that way. Keep in mind that many ecommerce features were built in an age when shopping experiences weren't digitally native. Ecommerce platforms were created to handle digital versions of physical stores. There are times when this analogy works just fine. Other times, like the shopping cart example, the store analogy isn't ideal and you can come up with better solutions that make your life much easier.

Enjoy the reading?

Subscribe to the newsletter and get a new article delivered to your inbox every week.