London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Hi there,
I have a case where I would like to share an "anonymous" cart across devices. Here it is possible for me to send "CustomerId" in a QueryString to the other device.
I use this code to share the cart between devices:
public ICart CloneAndLoadCart(Guid customerId) { var existingCart = _orderRepository.LoadCart<ICart>(customerId, DefaultCartName, _currentMarket); if (existingCart == null) return null; var clonedCart = (ICart)((Mediachase.Commerce.Orders.Internal.IDeepCloneable)existingCart).DeepClone(); clonedCart.CustomerId = CustomerContext.Current.CurrentContactId; SaveCart(clonedCart); return clonedCart; }
Can it be done in a better / nicer way?
It is said here, that "IDeepCloneable Interface" "is not intended to be used directly from your code".
Br
Lasse