Add Item to Cart Examples

Items can be added to the cart using either data hard coded into a model file or data retrieved from a html form or a database query.

This demo page shows many of the features and options that can be set when adding an item to the cart.
For simplicity and clarity, the items in these examples are added to the cart using links related to data that is hard coded into a model file.

Item Link Examples

Item Form Examples | Item Ajax Examples | Item Discount Examples | Item Database Examples
Basics
  • Example #101 : Add 1 item with minimum required data. An example of the minimum data requirements to add an item to the cart.
  • Example #102 : Add multiple items at once with 1 link. Multiple items can be added to the cart at the same time.
Shipping Examples
  • Example #103 : Add an item with free shipping. Items can be added to the cart with free shipping.
  • Example #104 : Add an item with free shipping to the UK only. Item shipping rates can be defined to only apply when shipped to specific locations.
  • Example #105 : Add an item with a shipping surcharge. Items can be defined to add a surcharge to the carts shipping rate, as above, this can be set by location.
  • Example #106 : Add an item that will be shipped separately from the rest of the cart. Items can be shipped separately from the rest of the cart, the items shipping cost is added to the carts shipping rate.
  • Example #107 : Add an item that CAN ONLY be shipping to a specific location(s) (United Kingdom). Items can be added to a 'Whitelist' of locations that the item is allowed to be shipped to.
  • Example #108 : Add an item that CANNOT be shipped to a specific location(s) (United Kingdom or France). Items can be added to a 'Blacklist' of locations that the item is not allowed to be shipped to.
  • Example #109 : Add an item with a defined weight that can be used to calculate shipping. A tier of shipping options can be setup to charge a different shipping rate for different weight orders.
Tax Examples
  • Example #110 : Add a tax free item. Items can be set with a defined tax rate that differs from the default cart tax rate.
  • Example #111 : Add an item with a specified tax rate. Items can be set with a defined tax rate that differs from the default cart tax rate.
Stock Examples
  • Example #112 : Add an item that is stock controlled and is in-stock. If a quantity of more than the stock quantity is added, the quantity can be set to be automatically adjusted.
  • Example #113 : Add an item that is stock controlled and is out-of-stock. Out-of-stock items can be set to be automatically removed from the cart, or display a message stating the item is out-of-stock.
Misc. Examples
  • Example #114 : Add an item with a specified number of reward points. Customers can earn reward points from buying items, points can either be specifically defined or calculated by the cart.
  • Example #115 : Add an item with preset options. Items can be added with options set, with this example, the options are preset.
    See the Item Form Examples for examples of adding items with selectable options.
  • Example #116 : Add an item with misc. data fields, in this example: a 'User Note' and an 'SKU'. Custom user defined data can be added to items, this data can then be displayed and saved with the cart order.
  • Example #117 : Add an item that is given its own unique row everytime its re-added to the cart. Duplicate items added to the cart can either increment the items quantity, or be added as a separate row.