Skip to content

Instantly share code, notes, and snippets.

@makfruit
Forked from genee19/new_gist_file
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makfruit/02f4fac0cc54d8321c12 to your computer and use it in GitHub Desktop.
Save makfruit/02f4fac0cc54d8321c12 to your computer and use it in GitHub Desktop.
A simple JS snippet to add product to the cart using Ecwid Javascript API
var product = {
id: 10,
quantity: 3,
options: {
someTextOption: "optionVal",
someDateOption: new Date().getTime().toString(),
someRadioOption: "optionVal",
someDropDownOption: "optionVal",
someCheckboxOption: ["optionVal1", "optionVal2"]
},
callback: function(success, product, cart) {
// ...
}
}
Ecwid.Cart.addProduct(product);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment