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
SwitchWishlistToUseLiveVersionOfProducts(SiteInitializer initializer)
{
var ordersManager = OrdersManager.GetManager();
var catalogManager = CatalogManager.GetManager();
var wishlists = ordersManager.GetWishlists();
foreach
(Wishlist wishlist
in
wishlists)
{
try
{
foreach
(var detail
in
wishlist.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);
}
}
}