AddCartItem.ss

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 } }