Do you need to build one at all? Most of this has been done for you in various shopping cart packages including google checkout, oscommerce, and others, but if you must take the plunge try to at least think about the following...
- Secure session for users
- Storing 'items' in the cart via the session / cookies
- Payment processing
- what external systems do you interface with
- what kinds of payments do you accept
- what currencies do you accept
- Some kind of dispatching system for when a purchase occurs
- If a purchase occurs, who is notified to mail out the items?
- where is the purchase logged?
- Interaction with an inventory system of some sort
- is the item in stock?
- what to do when out of stock?
- Total / shipping calculations
- how much do you charge shipping for different customers/destinations
- where do you want to ship / where will you not ship
A shopping cart is far more complex a concept than it appears to be. The specific answer to these questions will depend on what kind of organization you are working for. Big company? Small startup? Family business? High volume vs low volume? Etc.