Using the beta cart/checkout (don't get me started on how awful this is...) and when a customer attempts to remove the last item in their cart (only one item left and removing it), the beta cart/checkout makes a call to cart.ss and to remove the item using the commerce API removeItem(...).
However, the last item remains in the cart (using Chrome and IE9 to test).
The code segment is as follows:
var orderObj = nlapiGetWebApplication().getShoppingSession().getOrder(); var itemid = params.orderitemid; orderObj.removeItem(itemid);
I added some debugging where I get the line count for the cart (custom function). var orderObj = nlapiGetWebApplication().getShoppingSession().getOrder(); var linecnt = get_line_count(orderObj); nlapiLogExecution('DEBUG','BEFORE LINE COUNT','LINE COUNT = '+linecnt); var itemid = params.orderitemid; orderObj.removeItem(itemid); // get new refreshed/updated order object orderObj = nlapiGetWebApplication().getShoppingSession().getOrder(); linecnt = get_line_count(orderObj); nlapiLogExecution('DEBUG','AFTER LINE COUNT','LINE COUNT = '+linecnt); This produces the following in the log execution record:BEFORE LINE COUNT LINE COUNT = 1AFTER LINE COUNT LINE COUNT = 1Am I missing something or is this a bug or known issue when there is only one item left in the cart and the removeItem is called?