i used to believe addItem() returns the line id, b...
# suitecommerce
v
i used to believe addItem() returns the line id, but apparently it doesn't
s
It returns the orderitemid. If it's not you need to check your code is set up to handle it
v
Yes, it does return the orderitemid, but that info doesn't help me retrieve the line ID of the item on the Sales Order.
s
Pretty sure we set a session object for the last item added to the cart which you can probably get with
getSessionObject('latest_addition')
Is there a specific reason why you're using the commerce API because we make this info available via the LiveOrder.Model singleton (
getLatestAddition()
) although strangely not via the cart component
v
There's no specific reason for using Commerce API. Do you think there's a better alternative that I should use?
s
Yeah the live order model singleton
@Viraj Shinde Why do you need the latest item?
v
When I add an item to the cart programmatically, I need to know which line number it was added to so that I can pass that info to another module in our solution. We might not need to do that at all, but it's good to know if there's a way to do it
I'll also explore about the Live Order singleton @Steve Goldberg Thanks for your inputs 🙂