Hi! When I use the *<Commerce API>*: nlapiGetWebCo...
# suitecommerce
s
Hi! When I use the Commerce API: nlapiGetWebContainer().getShoppingSession().getOrder() in service file, I am facing some errors (UNEXPECTED ERROR when I call Order Methods). I am calling this API after the user is logged-in. I want to extract the cart items from the order object. Anyone has any idea about what I am missing or what might be wrong here? Kindly share if you know about any alternative ways to get cart items while inside service file. Many Thanks.
More specifically, I am trying to run this code:
const orderObj = *nlapiGetWebContainer().getShoppingSession().getOrder();*
const cartItems = orderObj.getItems();
The second line here is giving me an UNEXPECTED ERROR.
g1465.png
g
Try changing const to var, ES6 is not supported in SS1.
👍 1
s
@Gaston Mosteiro, same results with "var" as well. Just want to know, did the API worked for you?
d
try using ModelsInit.order.getItems() importing ''SC.Models.Init'
👍 1