This issue can be caused if there was any problem while upgrading products to use life cycle. Once you are sure that all of the products are upgraded correctly (i.e they are published), run the script below:
private void SwitchOrdersToUseLiveVersionOfProducts(SiteInitializer obj)
{
var ordersManager = OrdersManager.GetManager();
var catalogManager = CatalogManager.GetManager();
var orders = ordersManager.GetOrders();
foreach (var order in orders)
{
try
{
foreach (var detail in order.Details)
{
Guid oldProductId = detail.ProductId;
var product = catalogManager.GetProduct(oldProductId);
if (product != null)
{
var liveVersionOfProduct = catalogManager.Lifecycle.GetLive(product);
if (liveVersionOfProduct != null)
{
detail.ProductId = liveVersionOfProduct.Id;
}
}
}
ordersManager.SaveChanges();
}
catch (Exception ex)
{
EcommerceLogger.LogException(ex);
}
}
}