Add Item to Cart via Ajax 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 examples of how to add items to the cart using ajax.

Item Ajax Examples

Item Link Examples | Item Form Examples | Item Discount Examples | Item Database Examples
Add items via Ajax using a link
  • Example #501 : Add 1 item via an ajax link. An example of adding an item to the cart via ajax using a link.
  • Example #502 : Add 3 items at once via an ajax link. An example of adding 3 items at once to the cart via ajax using a link.
Add items via Ajax using a form
Example #503
This example allows for multiple options per item to be selected.
An array of all the option data is then also added to the item data, which can enable the user to change options after the item has been added to the cart.

  • £45.25

Example #504
This example updates the items price depending on the option selected.
The example does not submit an array of the items options, so the user cannot change the selected option once added to the cart.