Adds a product to the specified shopping cart.

To add products to a visitor's shopping cart, click a URL containing the Add command (alternately, you may embed an [AddLineItem] context in a template). Whenever WebCatalog receives an Add command, it opens the shopping cart file (creating a new one if necessary) and adds the product (identified by its SKU) to the end of the LineItems in the shopping cart. The item's price, taxable, canEmail, and unitShipCost information is found by looking for the values of those fields in the product database. You can use a different price by creating a Formulas.db database. Also see Remove, Clear, ShowCart, and Purchase.

Example (normally you would link to a URL or form containing the following information):

Try It!

The database "SomeDatabase.db" is opened, and sku 1234 is found. Shopping Cart file "5678" is opened, and a new line item is added to the bottom of the list, with a quantity of 5 (as specified in the command above), and a price taken from the database's price field. The page sent back to the browser will be xx.tpl, which typically contains a [LineItems] loop to display the current items in the cart.

Here are the parameters to the Add command:
Parameter Description


Product database that contains the SKU, price, and other information


Uniquely identifies which product should be added to the cart.


Shopping cart file that is to be affected
Optional Parameters Description


(Optional) Extra information of any kind that you want associated with this line item. Often used to store extra product information, such as "shoe size" or "color". Also used to pass catalog database fields such as [title] through to the order file


Same as textA above


Same as textA above


Same as textA above


Same as textA above


(Optional) Tells how many of this SKU should be added to the cart. This quantity is used when calculating totals, unitShipCost, etc.


(Optional) "T" or "F". Overrides "taxable" field in the database - normally the information about the item's taxable status is taken from a field called "taxable"


(Optional) "T" or "F". Overrides "canEmail" field in the database - normally the information about the item's canEmail (electronically deliverable) status is taken from a field called "canEmail"


(Optional) A number indicating the item's price for shipping. Overrides "unitShipCost" field in the database - normally the information about the item's unitShipCost status is taken from a field called "unitShipCost". ShipTotal and GrandTotal use this number (multiplied by quantity) to determine the total shipping and grand total.


Template of HTML to be displayed after adding the new item to the cart (typically a shopping cart template thanking the visitor for choosing a product to buy).

Header Field

You may set any shopping cart header field (such as Name, taxRate, Address1, etc.) at the same time you add a product to the cart.


You may force the visitor to enter something into a field by using the RequiredFields parameter in the URL. Setting RequiredFields=field1+field2+field3 will display an error message if the visitor forgets to enter some text into any of those 3 fields. RequiredFields works for all commands, not just this one.