Umbraco.Commerce.Issues
Umbraco.Commerce.Issues copied to clipboard
OrderReadOnly seems to be caching data but not refreshed when a Product is added
We have noticed in testing that adding an item to an Order does not refresh the OrderReadOnly, although the Order is updated succcesfully.
For example:
commerceApi.Uow.Execute(uow =>
{
var store = CurrentPage.GetStore();
var order = commerceApi.GetOrCreateCurrentOrder(store.Id);
var writableOrder = order.AsWritable(uow);
// order.OrderLines.Count() == 4
// writableOrder.OrderLines.Count() == 5
writableOrder.AddProduct(postModel.ProductReference, postModel.ProductVariantReference, 1,
new Dictionary<string, string>{
{ "imageUrl", product?.RollupImageV2?.MediaUrl() }
});
commerceApi.SaveOrder(writableOrder);
uow.Complete();
});
The only way we've gotten the true order line-item count/quantity count, is to restart the website. This is a problem in both the back-office Orders list as well as the front end.
Umbraco.Commerce version: 12.1.2