Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
AI OnAI Off
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Hi, Sapna
You could add a new lineItem with same SKU and also add some personal value into that. Those codes below is example:
var orderRepository = ServiceLocator.Current.GetInstance<IOrderRepository>(); var cart = orderRepository.LoadOrCreateCart<ICart>(customerId, "Default"); var lineItem = cart.CreateLineItem(entryCode); lineItem.Quantity = 1; lineItem.PlacedPrice = 100; lineItem.Properties["personalValue"] = "customValue ... "; var shipment = cart.GetFirstShipment(); shipment.LineItems.Add(lineItem); orderRepository.Save(cart);
And you could repeat this with the same entry code to add more lineitem.
var cart = orderRepository.LoadOrCreateCart<ICart>(customerId, "Default"); var lineItem = cart.CreateLineItem(entryCode); lineItem.Quantity = 1; lineItem.PlacedPrice = 100; lineItem.Properties["personalValue"] = "other value ... "; var shipment = cart.GetFirstShipment(); shipment.LineItems.Add(lineItem); orderRepository.Save(cart);
Hope this helps,
/Son Do
We need to add same SKU to cart as different lienitems. This happens when there is a item with personalized information. A customer can add 1 item with personalization values and another with a different personalization value. In this situation the same SKU needs to be added twice to the cart as individual lineitem. This fails.
var orderService = ServiceLocator.Current.GetInstance();
orderService.Save(cart);
Is there a way to customize the IOrderRepository.Save(cart) method? Which Dll can have its detailed implementation?