Question about e-commerce checkout

Hello. I am building my own e-commerce site, and have a question about WHAT should happen WHEN during the shopping and checkout process.

On the backend, I have the following text-book tables you’d expect to see in any e-commerce site…

  • Customer
  • Order
  • Order_Details
  • Product

I also have a Shopping_Cart table where I stash stuff immediately.

When should I add a record to my Order and Order_Details tables?

Option #1: Create Order and Order_Details records the moment the shopper adds an item to their shopping cart. (i.e. Super early!)

Option #2: Create Order and Order_Details records only after the shopper chooses “Proceed to Checkout”. (i.e. Medium)

Option #3: Create Order and Order_Details records only after the shopper chooses “Process Order”. (i.e. Super late!)

Since I already have a Shopping_Cart table where I can capture all shopping activities for both new and existing Customers, I guess I was originally leaning towards Option # 3

Option # 1 and Option # 2 seem sort of messy because if a Customer bails, then I have Order and Order_Detail records that fill up my database. Then again, maybe it is good - for the Customer - to save their info sooner in case something happens?

I suppose any of the options above will work, but maybe some of the “experts” here can share some wisdom with me as to why one design is better (or worse) than another? :wonky:


#1 that’s a shopping cart
#2 that’s still a shopping cart
#3 is the place to go, because that’s when he sets a legally binding order. And normally, orders are parts of invoices.

True, but just because you create an Order and Order_Details record doesn’t make anyone liable to pay for an order - my question is a design question and not a legal one.

From design and technical standpoint, why would you choose one of the options above over others?

I wouldn’t be cluttering the orders database with shopping cart information until it actually turns into an order. While it’s in the cart, it’s just a list while the user shops around for best prices or whatever. Most sites I’ve used tend to keep hold of the shopping cart data for a while in any case, so there’s no need for the shopper to re-enter their order just because they went away from the site for a few days.

Of course, each time the user comes back to the shopping cart, you’ve got to check that stuff that was in stock when added to the cart is still in stock, or in some cases, even exists in the product list.

(BTW - not an “expert” by any description.)

Well, I did design in a shopping_cart table…

Okay, so I will save creating Order and Order_Details records until the user clicks “Process Order”.

And I guess as long as I use a “transaction”, if thinks puke, then I have a way to exit gracefully, right?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.