When we call AcceptChanges on CartHelper, We got a SQL exception from this stored procedure :
Error : The formal parameter "@AllowBackordersAndPreorders" was not declared as an OUTPUT parameter, but the actual parameter passed in requested output.
Why EPiServer code set @AllowBackordersAndPreorders as an InputOutput parameters ? @LineItemId should be InputOutput parameter according to SQL Schema.
After using decompiled sources on this version, I understand the error but I dont know how to fix it. EPiServer Code set the first MetaField from the MetaClass as an InputOutput parameter. In my case, it's @AllowBackordersAndPreorders not @LineItemId. Can I fix it to make sure @LineItemId it's the first one ?
That's very strange.
What does this query give you when you run it in context of commerce database
SELECT c.[MetaFieldId], f.Name FROM .[dbo].[MetaClassMetaFieldRelation] c inner join [dbo].MetaField f on c.MetaFieldId = f.MetaFieldId where MetaClassId in (Select metaclassid from [dbo].MetaClass where Name = 'LineItem')
Here the result for your query :
I've done the same query with LineItemEx because we have extra fields added to line item :
The @LineItemId seems to be the first one System Meta Field from both query.
I think I found the problem. My website is on a migration process from 6.2 / R1 to the lastest for both product. In MetaField table, the field IsKeyField was set to False (0) for every field. Thats why @LineItemId was not the first one.
Anyway to fix this without having futur problems ? I can set manually via SQL fields from my backup (R1 Commerce) but I can miss new fields ...
The Id metafield (LineItemId, OrderGroupId,... ) should have IsKeyField =1.
I don't know why it is 0 for you but I think you'll have to update them manually.