When trying to convert a cart to a purchase order, either by using method SaveAsPurchaseOrder() or through EPiServer Commerce GUI, we get the error message: "field can't be null" or "Failed to create Purchase Order. Error: field can't be null" respectively.
I suspect there are problems when EPiServer tries to copy the metadata from a lineItem but I am just guessing here. I've tried removing the metadata but it did not help.
Does anybody know or have any idéa about what's causing this error?
An error has occurred.
field can't be null
at Mediachase.Commerce.Storage.MetaStorageBase.DoGetByIndex(MetaField field) at Mediachase.Commerce.Orders.LineItem..ctor() at EPiServer.Commerce.Order.Internal.OrderGroupBuilder.CreateLineItem(String code) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyLineItems(IShipment sourceShipment, IShipment destinationShipment, IOrderGroup destinationOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyShipments(IOrderForm sourceForm, IOrderForm destinationForm, IOrderGroup destinationOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyOrderForm(IOrderGroup orderGroup, IOrderGroup sourceOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.IOrderGroupExtensions.CopyFrom(IOrderGroup orderGroup, IOrderGroup sourceOrderGroup, IOrderGroupFactory orderGroupFactory) at EPiServer.Commerce.Order.Internal.SerializableCartProvider.SaveAsPurchaseOrder(ICart cart) at EPiServer.Commerce.Order.DefaultOrderRepository.SaveAsPurchaseOrder(IOrderGroup orderGroup) at
We would need more information regarding this case. I would suggest you to contact our developer support for further assistance, we probably need to look at your metafields, and your code.
It looks like you are using the new Serialized carts, i would suggest you make sure that the LineItem used by the orders actually have all the fields that are present in the serialized data.
I have not used the new carts myself thou.