Posted on 11/08/2022 08:32:24
Hi Nicolai, Just a follow up question.
Would it also be possible to do something like this specifically for punchout users? Instead of using this flag FullCartIsolation. I tried playing around with whats below in OnExtranetLogin subscriber. The cart is created - but when I then add something to a cart it creates a new cart. Does it not make sense to follow this path and is it possible? Or would you recommend the suggestion you had above? My example code is below for creating the cart in the subscriber.
Any thoughts appreciated.
code:
string contextId = System.Web.HttpContext.Current.Session.SessionID;
Context.CartContext = new OrderContext() { Id = contextId, Name = contextId, Shops = new List<string>() };
Context.CartContext.Save();
var orderService = new OrderService();
var cart = new Order(Context.Currency, Context.Country, Context.Language) { IsCart = true, LanguageId = Context.LanguageID, ShopId = "SHOP6", OrderContextId = contextId, VisitorSessionId = contextId};
orderService.Save(cart);
Context.SetCart(cart);
Context.SetPersistentCartContext(contextId);