AddCartItem.ss

Note:

For more information on SuiteScript 1.0, see SuiteScript 1.0 Guide.

          function service(request,response)
{
  var itemid = request.getParameter('itemid');
  var qty = request.getParameter('quantity');
 
  // create a plain object for the itme
  var item = {internalid : itemid, quantity: qty}
 
  // Get a reference to the shopping order
  var order = nlapiGetWebContainer().getShoppingSession().getOrder();
 
  // Add the item to cart
  try
  {
    var returnval = order.addItem(item);
 
    response.writeLine(JSON.stringify(returnval));
  }
  catch (e)
  {
    var e2 = nlapiCreateError(e);
    // Do error handling here
  }
 
} 

        

Related Topics

Sample_Cart.ssp
Cart_WithService.ssp
UpdateQuantity.ss
AddCustomerAddress.ss
Example .ss File Code that Accesses a NetSuite Record
ItemOption.ss
Known Issue with Internet Explorer and Plain Text Content
Sample SSP Application Code (SuiteScript 1.0)
SuiteScript 1.0 SSP Applications
Create and Use SSP Applications

General Notices