Hi - which version are you using? I'm quite sure the later version of Commerce fixed this issue. However for serializable carts, as long as the lineitemid is unique within a cart, it should not be a problem.
We are using 22.214.171.124, is this a version where the issue would still exist?
I remembered it a bit reverse, so the fix actually make the id negative, so no worries, it's all fine. To answer your question - Is it supposed to be like that? - yes. If you add another lineitem to the cart it should have id of -2.
My statement above still holds
"However for serializable carts, as long as the lineitemid is unique within a cart, it should not be a problem. "
Great! I was just surprised over the negative id, but of course, its not a problem as long as they are unique.
We are using serialized carts to store cart content. When saving the line item, I notice that the id for all line items are -1 in the SerializableCart-table in the database, whereas the line items have IDs in Commerce Manager. Is it supposed to be like that? Could we, when loading the cart and its line items, get hold of the line item id as seen in Commerce Manager?
Here is an outline of what I'm doing when creating the cart.
var cart = _orderRepository.LoadOrCreateCart<ICart>(contactId, nameOfCart);
var lineItem = cart.CreateLineItem(code, _orderGroupFactory);
And later, when loading the created cart, the line item ids are all -1. Why is that?
var loadedCart =_orderRepository.LoadCart<ICart>(contactId, nameOfCart);