

Ask HN: What is a shopping cart and why wouldn't I just write my own? - karlrossmann

Hi HN-<p>I'm having trouble understanding a very basic concept.  I build an online store, and since I'm a programmer, I let the user collect their items in a table associated with their session id.  Then, I compute the order total. My server goes to the payment gateway server and charges the credit card.  Then I ship stuff.  What is the purpose of a shopping cart and why would I pay for a 3rd party one?  They all appear to require some kind of programming, but if I already know how to program, why wouldn't I just build my own?<p>Note: I'm not being a smart-ass, I really don't understand what I'm missing, but I'm obviously missing something.  Can someone explain what a shopping cart is to an e-commerce newbie?<p>Thanks for any help,
Karl
======
MattBearman
I think you're misunderstanding what an off the shelf shopping cart is. It's
not just a way of storing the items a user has chosen along with their
quantities, like you say, all that requires is a session array.

It's product management and categorising, product options, coupons and
discounts, multiple tax rates, bulk buy discounts, user registration, payment
gateway integration, promotions, image galleries, I could go on.

Basically when you buy an off the shelf system like zen cart, you're getting
an entire e-commerce site that you just configure and style. And even if it's
not a full site, but a PHP library to interface with your own site, it's a lot
more than just the action of storing product id's and quantities in a session.

~~~
karlrossmann
wow, thanks Matt. This is the answer i have been waiting for. this is my
misunderstanding. i get it now, it's not that a basic shopping cart isn't
trivial, it's that it quickly expands to a full time job. thanks for
enumerating specifics.

~~~
SabrinaDent
I would also add that an off the shelf cart system will come with a fully
fledge back end. This is nice because you can make use of reusable product
options, discounting, automated email receipts, etc. But it's even _nicer_
because you can get admin reporting like month to month sales figures, daily
totals, most popular product rankings, and running discount totals. Sure you
can track this in Excel but the point is that you don't have to. The ability
to update, adjust and refund orders from an interface integrated with the
store is nice, too.

Absolutely you can roll your own, but unless you have a really defined and
limited product range it's just likely your needs will scale more quickly than
your code, is all.

------
mthomas
Some things your shopping cart might be missing which are non trivial.

    
    
      - Coupons or PROMOS ( X% off, $Y off, stackable)
      - Persisting a shopping cart between visits if an user doesn't checkout.
      - Saving items from a shopping cart to wishing list and vice-versa
      - Integration with multiple payment gateways but exposing a single interface

------
WillyDmz
You can definitely write your own shopping cart if you want, its just that its
a problem that so many businesses have solved before so you'd likely just be
wasting time reinventing the wheel when you could be building up other aspects
of your business, finding clients, marketing, etc.

~~~
karlrossmann
See, this is what I don't understand. Building a shopping cart is like 15
minutes of work if I'm already building my own e-commerce site, isn't it? Are
3rd party shopping carts for non-programmers? I mean, as far as I can tell,
it's literally just a session-associated table of items. What _else_ is a
shopping cart besides that? Why would I spend 2 days reading the "Zen cart"
manual and API when I can finish my home brewed shopping cart in 15 minutes?
Again, I'm not being a smart-ass, I really don't see what I'm missing. (thanks
for your reply)

~~~
pg
Robert Morris wrote Viaweb's shopping cart. He is a smart programmer, and he
found it nontrivial. Years later he was still encountering bugs from weird
combinations of user actions.

~~~
staunch
Dell finds it nontrivial as well. I just used their shopping cart. At one
point it wiped out the entire contents of my cart when I added an item from a
different section.

------
patrickyeon
Because you're going to get it wrong. No offence intended, I would too, but if
you haven't been sleeping, eating, breathing security for a while, you're
going to make a mistake, and it'll cost people.

And all the other points about it needing more functionality than you'd
expect.

------
rms
See <http://news.ycombinator.com/item?id=1607261> for tips about which
shopping cart to use

